Decentralized Chat Communication Protocol

I am designing a chat application in which there is no central server or db handling all the incoming and outgoing messages. It will be entirely decentralized.

A sum up of my project and its requirements

  • Each user will communicate via android phone to a particular node allotted to them. This node will then communicate directly with the node belonging to the user he wishes to message

  • Chat messages will be communicated between nodes via a p2p protocol forked from one of the libraries used for Ethereum

  • The chat will have a limited number of users, 1500-2500

  • Mapping the nodes to the users will be done via DHT and is not an issue

  • I want to depend as little as possible on GCM

  • The server will be written entirely in Node js. I have read extensively on XMPP, socketio and websockets but am unable to come to a conclusion on what to use. Keeping in mind that the code I write will be deployed across multiple nodes ie servers

  • And of course, the app will have a background service running and will need to show notifications for new messages when the app is in the back ground or not running at all

  • A quick deployment is the least important factor for me. I am just looking for the most powerful and customizable end product

  • I would like to stick with nodejs for the server

  • Is the primary advantage of XMPP over websockets that in XMPP a lot of the features needed for chat is out-of-the-box? Or is there more to it?

    I have a list of libraries obtained from various stack questions and seen examples for xmpp and websocket implementations.

    An increase in delay of a 1-2 seconds is NOT a problem in my case, but battery conversation is important.

    This link suggests battery consumption with websockets is not a problem.


    Check MQTT protocol. It's lightweight and uses minimum data.

    链接地址: http://www.djcxy.com/p/94174.html

    上一篇: 在elasticsearch中存储聊天消息的最佳方式

    下一篇: 分散式聊天通信协议