Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server-Client push notification with Python

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.

like image 363
ntcong Avatar asked Nov 08 '12 10:11

ntcong


1 Answers

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

like image 157
andrefsp Avatar answered Sep 24 '22 02:09

andrefsp