java - IM即时通信服务器原理
黄舟
黄舟 2017-04-18 10:49:37
0
2
558

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

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

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

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

除了openfire还有什么 开源实现

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all (2)
巴扎黑

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

    迷茫

    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

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!