ipfs-pubsub-room icon indicating copy to clipboard operation
ipfs-pubsub-room copied to clipboard

How do you associate a node id with a user identity

Open zicodeng opened this issue 6 years ago • 1 comments

I have user stored in database. When this user logs in and starts 1-on-1 chat with another user, we create a room for them. When the user joins, we get a peer joined event, but this peer CID is not associated with the user at all. What is the best way to associate node id with a user identity?

Also there seems to a significant delay when peer joined event is fired

Thanks in advance!

zicodeng avatar Nov 09 '19 06:11 zicodeng

So here is my solution, not sure it is the best approach, happy to discuss with everyone here.

Similar to TCP 3-way handshake, I need other users to confirm that I have successfully joined the room first via peer joined event, then other users will broadcast this peer ID. If it happens to be my peer ID, that means I have successfully joined. Now, I can broadcast my identity to everyone in the room

Here is the repo: https://github.com/zicodeng/dchat, it has demo link in it

Thanks

zicodeng avatar Nov 09 '19 08:11 zicodeng