Home  >  Q&A  >  body text

tornado - 求助:想开发一个1对1类似微信一样聊天的服务,该如何实现?python

高洛峰高洛峰2711 days ago345

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-18 10:04:55

    After the server socket receives the connection, calling accept will generate a new socket object used to communicate with the client. So the server only needs to keep the two socket objects of you and your friend. For example, s1 and s2. Then when the server receives the message from s1. The server then sends it to your friend through s2.
    This is my idea, I haven’t tried it myself. You can refer to it.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:04:55

    Tornado officially has chatroom examples, chatroom demo

    There is also code interpretation on SF

    reply
    0
  • Cancelreply