I found this project: http://code.google.com/p/standalonewebsocketserver/ for a websocket server, but I need to implement a websocket client in python, more exactly I need to receive some commands from xmpp in my websocket server.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Autobahn has a good websocket client implementation for Python as well as some good examples. I tested the following with a Tornado WebSocket server and it worked.
Since I have been doing a bit of research in that field lately (Jan, '12), the most promising client is actually : WebSocket for Python. It support a normal socket that you can call like this :
The
client
can beThreaded
or based onIOLoop
from Tornado project. This will allow you to create a multi concurrent connection client. Useful if you want to run stress tests.The client also exposes the
onmessage
,opened
andclosed
methods. (WebSocket style).http://pypi.python.org/pypi/websocket-client/
Ridiculously easy to use.
Sample client code:
Sample server code:
web2py has comet_messaging.py, which uses Tornado for websockets look at an example here: http://vimeo.com/18399381 and here vimeo . com / 18232653