I am writing a decentralized chat application using nodejs , expressjs , angularjs , socket.io and ipfs . I use libp2p to form nodes that will communicate with each other through an open connection. Libp2p is a network stack modular from the IPFS project.
Libp2p allows me to create nodes that can host swarm or listening/ dialing for one. I have developed to such an extent that several nodes can communicate with each other via the inputs on the angularjs web page (supplemented by socket.io), but their IP addresses and tcp ports must be hardcoded.
The problem that I am facing is that if an unknown number of users join this system and configure their nodes, how do I handle the script. I did a lot of research on DHT specifically in my torrent application, but not where it is almost impossible to apply it.
I donβt want to run a central system that tracks users, as the tracker tracks seeders and grubs in torrents (now somewhat redundant due to DHT)
In a centralized chat application, every time a user logs in or out, I can send an emit event from the server to all peers using socket.io signaling. But the equivalent in a decentralized chat application is what I'm struggling with.
I need to be guided.
source share