Decentralized Chat Application Using IPFS

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.

+5
source share
1 answer

You do not have to worry about this problem, as libp2p will handle node discovery and connection. At the end, you get a primitive for addressing the process, which will always dial to the process, if it is available on the network.

I recently worked on the best documentation and tutorials for libp2p, go to https://github.com/libp2p/js-libp2p/tree/master/examples and https://github.com/libp2p/js-libp2p . Additional examples for next week, including peer-to-peer routing + content routing (also DHT).

Hooray!

+1
source

All Articles