D-Chat

Hello,

I’ve made an experimental D-Chat as a browser extension. If anyone would like to try it out on Firefox: https://addons.mozilla.org/en-US/firefox/addon/d-chat/ .

Chrome: https://chrome.google.com/webstore/detail/d-chat/glnmkakdjcognfgonjfcklpmjiobijii

You can find the zips here: https://gitlab.com/losnappas/d-chat/-/releases , if you want to install it manually.

It’s a fork of this Web3Infra Alliance Launch and D-Chat application .

Source code: https://gitlab.com/losnappas/d-chat

It reminds me of IRC in functionality. Uses the pubsub system. so if that starts costing $$$ once mainnet hits, then this will be as good as dead, lol. Update: Still working & free!

Donations are always very appreciated:

ERC20: 0x87107249Bf26A6c5CA9D55E05b7BF29aD50CD7C8

NKN coin (if you want to give me some of your mining rewards, for example): NKNaaUAAYNoZoDyRF3LoJLSsczo77vU38yz1

To the moon!

2 Likes

Hi Lynn, so happy to see you create a new D-Chat. Let us test it out!

1 Like

Glad to see this one!

I don’t see any reason for nkn client to cost any $$$ for a long time. I think it would take really long for the network to be crowded enough since the network should be able to handle probably millions of packets per second after mainnet and it will continue to grow as there are more nodes :slight_smile:

Also see your comments in the code. Both bucket and subscribe duration (your FORBLOCKS) are useful:

  1. bucket is used to restrict how many addresses can subscribe to a topic to avoid msg flooding, so if there are more than 1000 (the current bucket limit) addresses subscribed to the same topic, we’d need to increase bucket id to stay in another bucket (of the same topic)
  2. subscribe duration determines how long the subscription is valid for, after that the address will no longer be subscribed to the topic and he would need to re-subscribe. Currently unsubscribe has not been implemented yet, so duration is the only way to unsubscribe at the moment.
1 Like

Just uploaded it to the Chrome store, it’s pending review which it said will take a couple of days max. I think it will show up here: https://chrome.google.com/webstore/detail/glnmkakdjcognfgonjfcklpmjiobijii/ . Not absolutely certain on that yet, though.

One thing I noticed this morning is that I receive messages even though I’m offline and my PC is off! How does that work? I went to sleep, and now I’m looking at the exchange between bruce and Allen about happy Mondays, which occurred at 4AM. I used that in my screenshots on the webstore, hope you don’t mind.
Is that a de facto feature of pubsub, or built in the nkn testnet node that is used as a bridge?

edit: I was compensated $50 worth of NKN tokens (750), thank you very much!

That’s all good news.

Is there a list of all the available rpc nodes somewhere? Right now the extension makes practically all requests through the testnet-node-0001.nkn.org or whatever, which isn’t really the ideal decentralization you’d hope for. If there was a JSON file of the IPs that I could find, then I could send messages to a different one every time, basically.

About the buckets: if I’m subscribed to bucket 0, will I receive messages that someone sends to bucket 1? Will the publish method take care of that? Well, it’s not a concern for the add-on at this time.

About the duration: for a chat application, I see that a “subscribe until unsubscribe” would be nice.

Here’s a few more things that I think should be useful, for anyone interested in extending the libraries:

  • getSubscribers
    • Already almost exists in the publish method.
    • Useful for getting the # of chatters online, for example.
  • isSubscribed (and for how long?)
    • Currently the only way(?) to know if you’re already subscribed is to re-sub and see the error.
  • subscribeToFirstOpenBucket

I’d add the first one myself, but I’m just heading to summer vacation and won’t be online for a couple of weeks.

Every NKN node can be served as a RPC node. Later we will provide a list of official nodes, and the sdk will randomly choose one when making request. You can also pass your own nodes.

For the buckets, it depends on how the publish side implement it. Currently sdk does not take care of that, but it can be implemented using the existing “gettopicbucketscount” rpc.

For the duration, we plan to add unsubscribe soon.

There are 2 existing rpc that can achieve your first and third requirement: “getsubscribers” and “getfirstavailabletopicbucket”. There is no isSubscribed yet but it shouldn’t be hard to add.

1 Like

https://chrome.google.com/webstore/detail/glnmkakdjcognfgonjfcklpmjiobijii/ looks doesn’t work yet, looking forwarding to have a try at Chrome :heart_eyes:

It went through the checks just now & is available on the Chrome store.

1 Like

Great, let me try it and feedback here

1 Like

Just released v1 on Firefox. It’s on Firefox only, so I can squash the bugs I might find, and because Firefox is the best. Chrome store still wants to review every new version, which takes like a week, so that’ll wait till it works.

Release notes:

Moved things to “background page”.

  • Now you’ll be able to get messages when your popup is closed, and you’ll see a number on the button badge.
  • The subscription spinner should work.
  • It’s faster.

One downside is that now you can only have one open chat, because state is shared.

I’m thinking about splitting the add-on into 2. One for the chat, and another one for an NKN wallet.

After that, I think it’ll be relatively easy to create a flow for accessing *.wikipedia.nkn. So I’ll probably do that.

EDIT: oh yeah, and in case anyone was actually using this yet, then rejoice, as your chats list went blank after the update. You’ll have to rejoin your chats.

1 Like

Hi Lynn,

Thanks a lot for the update! Is the new 1.0 working over mainnet or testnet? I just did a quick test but it seems spinning.

Bruce

It’s still on the testnet. Forgot to update the nkn wallet package.

seems spinning

Looks like I broke it, after all, huh. I get that now too. I’ll update to mainnet while I’m at it, I guess.

Suddenly I’m not seeing any new block events firing on the testnet. And mainnet threw me some errors, that I didn’t write down but cannot reproduce, too. I’m guessing it might have something to do with the nkn-wallet-js pointing to https://mainnet-rpc-node-0001.nkn.org/mainnet/api/wallet but nkn-client-js still points to http://testnet-node-0001.nkn.org:30003 . Right now I’m not seeing any block events on mainnet either.

What is the mainnet equivalent of the former? Github suddenly requires 2FA so forget about logging in, ever.

I’ll figure this stuff out tomorrow. It’s broken for the night regardless of what I do, I guess. The older version as well.

I did, In fact, find a bug in the extension, but fixing that didn’t do anything to the “spinner problem” because it cannot hear any block events, so subscriptions will never resolve.

Time for a rest and continue tomorrow. :grinning: I guess right now both mainnet and testnet want to take a rest as well. Should be fixed soonish.

1 Like

Still no block events. Don’t think publish is going through either. Can’t tell about subscribe.

Testnet or testnet-node-0001 appears bugged. I get the connect event, but no block events.
I don’t know any node on the mainnet that I could connect the nkn-client-js to, so I can’t even test it there. Tried the “mainnet/api/wallet” node on that, but it doesn’t respond.

Can you pick these seed nodes from mainnet? Will be nice to have it running over mainnet. :grinning:

Thanks for the list, but unfortunately they don’t work. I tried with the example in the repo as well.

$ node node_example.js http://testnet-node-0001.nkn.org:30003 10000
[] Send message from 97c7e3e64811c648.027c8c4361238e630b0d896a54e0e27808789fdf34afdc65cb9d4f2efbd147eb21 to 751d9dd8c8702b46.020213bc7f3e83e46d018688c5619c7fe890ce8b52949a293f027dbfe06c9b5fed
[] Receive text message "Hello world!" from 97c7e3e64811c648.027c8c4361238e630b0d896a54e0e27808789fdf34afdc65cb9d4f2efbd147eb21 after 137 ms
[] Receive "Well received!" from 751d9dd8c8702b46.020213bc7f3e83e46d018688c5619c7fe890ce8b52949a293f027dbfe06c9b5fed after 283 ms
$ node node_example.js http://mainnet-seed-0001.nkn.org:30003 10000

It just hangs forever.

what is your Discord handle? I can invite you to our community developer channel, where you will get the best support. This is our generic invite. but once you are in I can add you to the private channel.

It’s lynn#2453 .

Alright, try #2 is here. Version 2.0.2. On the mainnet!

1 Like