Server-Client push notification with Python

14,054

have a look on Python tornado http://www.tornadoweb.org/.

It is in fact a non-blocking webserver and you have a WebSocketHandler object which might be very useful for what you want to do.

http://www.tornadoweb.org/en/stable/websocket.html

Regards

Share:
14,054
ntcong
Author by

ntcong

"

Updated on June 04, 2022

Comments

  • ntcong
    ntcong about 2 years

    I'm building an client application, which connect to a server and wait for signal from server to do something (think about chat app). For example: user 1 has client 1 and 2, user 2 has client 3, the server would send the message to the channel "user 1" and only client 1 and 2 will have the message.

    I know about Websocket and Long-polling, but can't find a server which is self-hosted and easy to test. Initially I want to make a proof-of-concept first before dive in later.

    Nginx push stream seems to fit my need, I can create a channel, and notify all client connect to that channel, seem good enough to use, but I can't find any Python client implement

    AutoBahn and some other Python server seem only create one channel and broadcast.

    Can someone give me a correct direction.

  • ntcong
    ntcong over 11 years
    seems good, but what I need is a channel, for example: user 1 has client 1 and 2, user 2 has client 3, the server would send the message to the channel "user 1" and only client 1 and 2 will have the message. From what I read ZeroMQ doesn't fit it, right ?
  • Nicolas Barbey
    Nicolas Barbey over 11 years
    I think it does. Have a look at the pipelie pattern: api.zeromq.org/2-2:zmq-socket
  • ntcong
    ntcong over 11 years
    Ended up deciding with Tornado (specially the Socket.IO with Tornado) or Nginx Push Stream
  • andrefsp
    andrefsp over 11 years
    Excellent choice. =) Tornado + socket.io its a brilliant combination for WebSocket programming.