|
TestingYourWebSocketImplementation
Testing your server implementation using echo_client.py in pywebsocketFor example, to connect to ws://example.com:12345/test using HyBi 13 version protocol, and send three text frames "Hello", "foo", "bar" to it, run this: svn checkout http://pywebsocket.googlecode.com/svn/trunk/ pywebsocket-read-only cd pywebsocket-read-only/src PYTHONPATH=. python example/echo_client.py -s example.com -p 12345 -r /test \ -m Hello,foo,bar --protocol_version=hybi13 --origin=http://example.com:12345/ \ --log-level=debug Testing your client implementation using standalone.py in pywebsocketTo launch pywebsocket standalone server on port 12345 with echo back service on /echo with HyBi 13, HyBi 08, HyBi 00 and Hixie 75 protocol support, run this: svn checkout http://pywebsocket.googlecode.com/svn/trunk/ pywebsocket-read-only cd pywebsocket-read-only/src PYTHONPATH=. python mod_pywebsocket/standalone.py -p 12345 --allow-draft75 -d example --log-level debug Open http://localhost:12345/console.html using your client and check if the messages you send are echoed back. |
► Sign in to add a comment
how can to handle disconnect from device without any messages, ex. lost internet connection? Any exception on recvd or sent methods or others?
First, see this thread. http://groups.google.com/group/pywebsocket/browse_thread/thread/d341032b6e00cb1 To handle the case that the other peer disappears silently, you need to implement ping/pong and timeout logic by yourself. As latest WebSocket? protocol supports ping/pong in itself, pywebsocket may provide some automatic keep alive, but not yet implemented.
it says me : ImportError?: No module named mod_pywebsocket
Please make sure to prepend "PYTHONPATH=." before the command as instructed above to add mod_pywebsocket directory to Python's search path.
This is a convoluted example. It should be more like: wget something python some.py google-chrome example.html