Home  >  Q&A  >  body text

java - IM即时通信服务器原理

点对点 的 可以直接使用socket进行通信

但是一般的工程实现 都需要服务器进行转发

那么我想请问 服务器管理那么多连接

它是如何做到 可以将消息发送给想发送的人的

除了openfire还有什么 开源实现

黄舟黄舟2744 days ago626

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-18 10:51:37

    node.js + socket.io
    websocket

    What I did before was to use node.js + socket.io
    Put the connection information into a json. Use the key to identify which user it is. Then the message sent will hold this key and the server will forward it to the server through the key. The corresponding client.
    I only know the web and other things are not very clear

    reply
    0
  • 迷茫

    迷茫2017-04-18 10:51:37

    Compare with simple QQ. After the QQ user starts the client to log in, the user actually informs the server that he is online. Then the client handles the monitoring status of the server at this time. The so-called one-to-one message means that user A sends a message. The message goes out, and the message content must contain the content and receiver B. The server monitors the message, and then obtains clientSocket-B based on receiver B and forwards A's message to B. This is roughly the case

    reply
    0
  • Cancelreply