diff options
author | liris <liris.pp@gmail.com> | 2014-05-02 15:17:39 +0900 |
---|---|---|
committer | liris <liris.pp@gmail.com> | 2014-05-02 15:17:39 +0900 |
commit | 83dea7505112b0f424de825ab05ecbf87bd2138a (patch) | |
tree | e7318cc5a113a56e429af808de7794a67c2a9a29 | |
parent | 853628d0036294f9d6d09f36e2968e20bae400e0 (diff) | |
download | websocket-client-83dea7505112b0f424de825ab05ecbf87bd2138a.tar.gz |
Create gh-pages branch via GitHubgh-pages
-rw-r--r-- | index.html | 113 | ||||
-rw-r--r-- | params.json | 2 |
2 files changed, 58 insertions, 57 deletions
@@ -88,60 +88,60 @@ Default squid setting is "ALLOWED TO CONNECT ONLY HTTPS PORT".</p> <p>Low Level API example::</p> -<pre><code>from websocket import create_connection -ws = create_connection("ws://echo.websocket.org/") -print "Sending 'Hello, World'..." -ws.send("Hello, World") -print "Sent" -print "Reeiving..." -result = ws.recv() -print "Received '%s'" % result -ws.close() +<pre><code> from websocket import create_connection + ws = create_connection("ws://echo.websocket.org/") + print "Sending 'Hello, World'..." + ws.send("Hello, World") + print "Sent" + print "Reeiving..." + result = ws.recv() + print "Received '%s'" % result + ws.close() </code></pre> <p>If you want to customize socket options, set sockopt.</p> <p>sockopt example:</p> -<pre><code>from websocket import create_connection -ws = create_connection("ws://echo.websocket.org/". - sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),) ) +<pre><code> from websocket import create_connection + ws = create_connection("ws://echo.websocket.org/". + sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),) ) </code></pre> <p>JavaScript websocket-like API example::</p> -<pre><code>import websocket -import thread -import time +<pre><code> import websocket + import thread + import time -def on_message(ws, message): - print message + def on_message(ws, message): + print message -def on_error(ws, error): - print error + def on_error(ws, error): + print error -def on_close(ws): - print "### closed ###" + def on_close(ws): + print "### closed ###" -def on_open(ws): - def run(*args): - for i in range(3): + def on_open(ws): + def run(*args): + for i in range(3): + time.sleep(1) + ws.send("Hello %d" % i) time.sleep(1) - ws.send("Hello %d" % i) - time.sleep(1) - ws.close() - print "thread terminating..." - thread.start_new_thread(run, ()) - - -if __name__ == "__main__": - websocket.enableTrace(True) - ws = websocket.WebSocketApp("ws://echo.websocket.org/", - on_message = on_message, - on_error = on_error, - on_close = on_close) - ws.on_open = on_open - ws.run_forever() + ws.close() + print "thread terminating..." + thread.start_new_thread(run, ()) + + + if __name__ == "__main__": + websocket.enableTrace(True) + ws = websocket.WebSocketApp("ws://echo.websocket.org/", + on_message = on_message, + on_error = on_error, + on_close = on_close) + ws.on_open = on_open + ws.run_forever() </code></pre> <h1> @@ -151,37 +151,38 @@ if __name__ == "__main__": <p>sample for echo.websocket.org::</p> -<p>$ wsdump.py ws://echo.websocket.org/ - Press Ctrl+C to quit</p> - -<blockquote> -<p>Hello, WebSocket +<pre><code> $ wsdump.py ws://echo.websocket.org/ + Press Ctrl+C to quit + > Hello, WebSocket < Hello, WebSocket -How are you? - < How are you?</p> -</blockquote> + > How are you? + < How are you? +</code></pre> <h2> <a name="usage" class="anchor" href="#usage"><span class="octicon octicon-link"></span></a>Usage</h2> -<p>usage:: - wsdump.py [-h] [-v [VERBOSE]] ws_url</p> +<pre><code>usage:: + + wsdump.py [-h] [-v [VERBOSE]] ws_url -<p>WebSocket Simple Dump Tool</p> +WebSocket Simple Dump Tool -<p>positional arguments: - ws_url websocket url. ex. ws://echo.websocket.org/</p> +positional arguments: + ws_url websocket url. ex. ws://echo.websocket.org/ -<p>optional arguments: +optional arguments: -h, --help show this help message and exit WebSocketApp - -v VERBOSE, --verbose VERBOSE set verbose mode. If set to 1, show opcode. If set to 2, enable to trace websocket module</p> + -v VERBOSE, --verbose VERBOSE set verbose mode. If set to 1, show opcode. If set to 2, enable to trace websocket module +</code></pre> <p>example::</p> -<p>$ wsdump.py ws://echo.websocket.org/ +<pre><code> $ wsdump.py ws://echo.websocket.org/ $ wsdump.py ws://echo.websocket.org/ -v - $ wsdump.py ws://echo.websocket.org/ -vv</p> + $ wsdump.py ws://echo.websocket.org/ -vv +</code></pre> <h1> <a name="changelog" class="anchor" href="#changelog"><span class="octicon octicon-link"></span></a>ChangeLog</h1> diff --git a/params.json b/params.json index fd09e76..85e1f68 100644 --- a/params.json +++ b/params.json @@ -1 +1 @@ -{"name":"Websocket-client","tagline":"websocket client for python","body":"=================\r\nwebsocket-client\r\n=================\r\n\r\nwebsocket-client module is WebSocket client for python. This provide the low level APIs for WebSocket. All APIs are the synchronous functions.\r\n\r\nwebsocket-client supports only hybi-13.\r\n\r\nCAUTION\r\n============\r\n\r\nWe have a big change on version 0.14.0.\r\nSo, please test on trunk repository.\r\n\r\nv0.14 release schedule\r\n=======================\r\n\r\nNow, under testing.\r\nv0.14 will be released on May 15.\r\n\r\n\r\nLicense\r\n============\r\n\r\n - LGPL\r\n\r\nInstallation\r\n=============\r\n\r\nThis module is tested on Python 2.7 and Python 3.x.\r\n\r\nType \"python setup.py install\" or \"pip install websocket-client\" to install.\r\n\r\nThis module depend on\r\n\r\n - six\r\n - backports.ssl_match_hostname for Python 2.x\r\n\r\nHow about Python 3\r\n===========================\r\n\r\nNow, we support python 3 on single source code from version 0.14.0. Thanks, @battlemidget and @ralphbean.\r\n\r\nHTTP Proxy\r\n=============\r\n\r\nSupport websocket access via http proxy.\r\nThe proxy server must allow \"CONNECT\" method to websocket port.\r\nDefault squid setting is \"ALLOWED TO CONNECT ONLY HTTPS PORT\".\r\n\r\nCurrent implementation of websocket-client is using \"CONNECT\" method via proxy.\r\n\r\nExample\r\n=============\r\n\r\nLow Level API example::\r\n\r\n from websocket import create_connection\r\n ws = create_connection(\"ws://echo.websocket.org/\")\r\n print \"Sending 'Hello, World'...\"\r\n ws.send(\"Hello, World\")\r\n print \"Sent\"\r\n print \"Reeiving...\"\r\n result = ws.recv()\r\n print \"Received '%s'\" % result\r\n ws.close()\r\n\r\nIf you want to customize socket options, set sockopt.\r\n\r\nsockopt example:\r\n\r\n from websocket import create_connection\r\n ws = create_connection(\"ws://echo.websocket.org/\".\r\n sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),) )\r\n\r\n\r\nJavaScript websocket-like API example::\r\n\r\n import websocket\r\n import thread\r\n import time\r\n\r\n def on_message(ws, message):\r\n print message\r\n\r\n def on_error(ws, error):\r\n print error\r\n\r\n def on_close(ws):\r\n print \"### closed ###\"\r\n\r\n def on_open(ws):\r\n def run(*args):\r\n for i in range(3):\r\n time.sleep(1)\r\n ws.send(\"Hello %d\" % i)\r\n time.sleep(1)\r\n ws.close()\r\n print \"thread terminating...\"\r\n thread.start_new_thread(run, ())\r\n\r\n\r\n if __name__ == \"__main__\":\r\n websocket.enableTrace(True)\r\n ws = websocket.WebSocketApp(\"ws://echo.websocket.org/\",\r\n on_message = on_message,\r\n on_error = on_error,\r\n on_close = on_close)\r\n ws.on_open = on_open\r\n ws.run_forever()\r\n\r\n\r\nwsdump.py\r\n============\r\n\r\nwsdump.py is simple WebSocket test(debug) tool.\r\n\r\nsample for echo.websocket.org::\r\n\r\n $ wsdump.py ws://echo.websocket.org/\r\n Press Ctrl+C to quit\r\n > Hello, WebSocket\r\n < Hello, WebSocket\r\n > How are you?\r\n < How are you?\r\n\r\nUsage\r\n---------\r\n\r\nusage::\r\n wsdump.py [-h] [-v [VERBOSE]] ws_url\r\n\r\nWebSocket Simple Dump Tool\r\n\r\npositional arguments:\r\n ws_url websocket url. ex. ws://echo.websocket.org/\r\n\r\noptional arguments:\r\n -h, --help show this help message and exit\r\nWebSocketApp\r\n -v VERBOSE, --verbose VERBOSE set verbose mode. If set to 1, show opcode. If set to 2, enable to trace websocket module\r\n\r\nexample::\r\n\r\n $ wsdump.py ws://echo.websocket.org/\r\n $ wsdump.py ws://echo.websocket.org/ -v\r\n $ wsdump.py ws://echo.websocket.org/ -vv\r\n\r\nChangeLog\r\n============\r\n\r\n- v0.14.0\r\n\r\n - Support python 3(#73)\r\n - Support IPv6(#77)\r\n - Support explicit web proxy(#57)\r\n\r\n- v0.13.0\r\n\r\n - MemoryError when receiving large amount of data (~60 MB) at once(ISSUE#59)\r\n - Controlling fragmentation(ISSUE#55)\r\n - server certificate validation(ISSUE#56)\r\n - PyPI tarball is missing test_websocket.py(ISSUE#65)\r\n - Payload length encoding bug(ISSUE#58)\r\n - disable Nagle algorithm by default(ISSUE#41)\r\n - Better event loop in WebSocketApp(ISSUE#63)\r\n - Skip tests that require Internet access by default(ISSUE#66)\r\n\r\n- v0.12.0\r\n\r\n - support keep alive for WebSocketApp(ISSUE#34)\r\n - fix some SSL bugs(ISSUE#35, #36)\r\n - fix \"Timing out leaves websocket library in bad state\"(ISSUE#37)\r\n - fix \"WebSocketApp.run_with_no_err() silently eats all exceptions\"(ISSUE#38)\r\n - WebSocketTimeoutException will be raised for ws/wss timeout(ISSUE#40)\r\n - improve wsdump message(ISSUE#42)\r\n - support fragmentation message(ISSUE#43)\r\n - fix some bugs\r\n\r\n- v0.11.0\r\n\r\n - Only log non-normal close status(ISSUE#31)\r\n - Fix default Origin isn't URI(ISSUE#32)\r\n - fileno support(ISSUE#33)\r\n\r\n- v0.10.0\r\n\r\n - allow to set HTTP Header to WebSocketApp(ISSUE#27)\r\n - fix typo in pydoc(ISSUE#28)\r\n - Passing a socketopt flag to the websocket constructor(ISSUE#29)\r\n - websocket.send fails with long data(ISSUE#30)\r\n\r\n\r\n- v0.9.0\r\n\r\n - allow to set opcode in WebSocketApp.send(ISSUE#25)\r\n - allow to modify Origin(ISSUE#26)\r\n\r\n- v0.8.0\r\n\r\n - many bug fix\r\n - some performance improvement\r\n\r\n- v0.7.0\r\n\r\n - fixed problem to read long data.(ISSUE#12)\r\n - fix buffer size boundary violation\r\n\r\n- v0.6.0\r\n\r\n - Patches: UUID4, self.keep_running, mask_key (ISSUE#11)\r\n - add wsdump.py tool\r\n\r\n- v0.5.2\r\n\r\n - fix Echo App Demo Throw Error: 'NoneType' object has no attribute 'opcode (ISSUE#10)\r\n\r\n- v0.5.1\r\n\r\n - delete invalid print statement.\r\n\r\n- v0.5.0\r\n\r\n - support hybi-13 protocol.\r\n\r\n- v0.4.1\r\n\r\n - fix incorrect custom header order(ISSUE#1)\r\n\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
\ No newline at end of file +{"name":"Websocket-client","tagline":"websocket client for python","body":"=================\r\nwebsocket-client\r\n=================\r\n\r\nwebsocket-client module is WebSocket client for python. This provide the low level APIs for WebSocket. All APIs are the synchronous functions.\r\n\r\nwebsocket-client supports only hybi-13.\r\n\r\nCAUTION\r\n============\r\n\r\nWe have a big change on version 0.14.0.\r\nSo, please test on trunk repository.\r\n\r\nv0.14 release schedule\r\n=======================\r\n\r\nNow, under testing.\r\nv0.14 will be released on May 15.\r\n\r\n\r\nLicense\r\n============\r\n\r\n - LGPL\r\n\r\nInstallation\r\n=============\r\n\r\nThis module is tested on Python 2.7 and Python 3.x.\r\n\r\nType \"python setup.py install\" or \"pip install websocket-client\" to install.\r\n\r\nThis module depend on\r\n\r\n - six\r\n - backports.ssl_match_hostname for Python 2.x\r\n\r\nHow about Python 3\r\n===========================\r\n\r\nNow, we support python 3 on single source code from version 0.14.0. Thanks, @battlemidget and @ralphbean.\r\n\r\nHTTP Proxy\r\n=============\r\n\r\nSupport websocket access via http proxy.\r\nThe proxy server must allow \"CONNECT\" method to websocket port.\r\nDefault squid setting is \"ALLOWED TO CONNECT ONLY HTTPS PORT\".\r\n\r\nCurrent implementation of websocket-client is using \"CONNECT\" method via proxy.\r\n\r\nExample\r\n=============\r\n\r\nLow Level API example::\r\n\r\n```\r\n from websocket import create_connection\r\n ws = create_connection(\"ws://echo.websocket.org/\")\r\n print \"Sending 'Hello, World'...\"\r\n ws.send(\"Hello, World\")\r\n print \"Sent\"\r\n print \"Reeiving...\"\r\n result = ws.recv()\r\n print \"Received '%s'\" % result\r\n ws.close()\r\n```\r\n\r\nIf you want to customize socket options, set sockopt.\r\n\r\nsockopt example:\r\n\r\n```\r\n from websocket import create_connection\r\n ws = create_connection(\"ws://echo.websocket.org/\".\r\n sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),) )\r\n```\r\n\r\nJavaScript websocket-like API example::\r\n\r\n```\r\n import websocket\r\n import thread\r\n import time\r\n\r\n def on_message(ws, message):\r\n print message\r\n\r\n def on_error(ws, error):\r\n print error\r\n\r\n def on_close(ws):\r\n print \"### closed ###\"\r\n\r\n def on_open(ws):\r\n def run(*args):\r\n for i in range(3):\r\n time.sleep(1)\r\n ws.send(\"Hello %d\" % i)\r\n time.sleep(1)\r\n ws.close()\r\n print \"thread terminating...\"\r\n thread.start_new_thread(run, ())\r\n\r\n\r\n if __name__ == \"__main__\":\r\n websocket.enableTrace(True)\r\n ws = websocket.WebSocketApp(\"ws://echo.websocket.org/\",\r\n on_message = on_message,\r\n on_error = on_error,\r\n on_close = on_close)\r\n ws.on_open = on_open\r\n ws.run_forever()\r\n```\r\n\r\nwsdump.py\r\n============\r\n\r\nwsdump.py is simple WebSocket test(debug) tool.\r\n\r\nsample for echo.websocket.org::\r\n\r\n```\r\n $ wsdump.py ws://echo.websocket.org/\r\n Press Ctrl+C to quit\r\n > Hello, WebSocket\r\n < Hello, WebSocket\r\n > How are you?\r\n < How are you?\r\n```\r\n\r\nUsage\r\n---------\r\n\r\n```\r\nusage::\r\n\r\n wsdump.py [-h] [-v [VERBOSE]] ws_url\r\n\r\nWebSocket Simple Dump Tool\r\n\r\npositional arguments:\r\n ws_url websocket url. ex. ws://echo.websocket.org/\r\n\r\noptional arguments:\r\n -h, --help show this help message and exit\r\nWebSocketApp\r\n -v VERBOSE, --verbose VERBOSE set verbose mode. If set to 1, show opcode. If set to 2, enable to trace websocket module\r\n```\r\n\r\nexample::\r\n\r\n```\r\n $ wsdump.py ws://echo.websocket.org/\r\n $ wsdump.py ws://echo.websocket.org/ -v\r\n $ wsdump.py ws://echo.websocket.org/ -vv\r\n```\r\n\r\nChangeLog\r\n============\r\n\r\n- v0.14.0\r\n\r\n - Support python 3(#73)\r\n - Support IPv6(#77)\r\n - Support explicit web proxy(#57)\r\n\r\n- v0.13.0\r\n\r\n - MemoryError when receiving large amount of data (~60 MB) at once(ISSUE#59)\r\n - Controlling fragmentation(ISSUE#55)\r\n - server certificate validation(ISSUE#56)\r\n - PyPI tarball is missing test_websocket.py(ISSUE#65)\r\n - Payload length encoding bug(ISSUE#58)\r\n - disable Nagle algorithm by default(ISSUE#41)\r\n - Better event loop in WebSocketApp(ISSUE#63)\r\n - Skip tests that require Internet access by default(ISSUE#66)\r\n\r\n- v0.12.0\r\n\r\n - support keep alive for WebSocketApp(ISSUE#34)\r\n - fix some SSL bugs(ISSUE#35, #36)\r\n - fix \"Timing out leaves websocket library in bad state\"(ISSUE#37)\r\n - fix \"WebSocketApp.run_with_no_err() silently eats all exceptions\"(ISSUE#38)\r\n - WebSocketTimeoutException will be raised for ws/wss timeout(ISSUE#40)\r\n - improve wsdump message(ISSUE#42)\r\n - support fragmentation message(ISSUE#43)\r\n - fix some bugs\r\n\r\n- v0.11.0\r\n\r\n - Only log non-normal close status(ISSUE#31)\r\n - Fix default Origin isn't URI(ISSUE#32)\r\n - fileno support(ISSUE#33)\r\n\r\n- v0.10.0\r\n\r\n - allow to set HTTP Header to WebSocketApp(ISSUE#27)\r\n - fix typo in pydoc(ISSUE#28)\r\n - Passing a socketopt flag to the websocket constructor(ISSUE#29)\r\n - websocket.send fails with long data(ISSUE#30)\r\n\r\n\r\n- v0.9.0\r\n\r\n - allow to set opcode in WebSocketApp.send(ISSUE#25)\r\n - allow to modify Origin(ISSUE#26)\r\n\r\n- v0.8.0\r\n\r\n - many bug fix\r\n - some performance improvement\r\n\r\n- v0.7.0\r\n\r\n - fixed problem to read long data.(ISSUE#12)\r\n - fix buffer size boundary violation\r\n\r\n- v0.6.0\r\n\r\n - Patches: UUID4, self.keep_running, mask_key (ISSUE#11)\r\n - add wsdump.py tool\r\n\r\n- v0.5.2\r\n\r\n - fix Echo App Demo Throw Error: 'NoneType' object has no attribute 'opcode (ISSUE#10)\r\n\r\n- v0.5.1\r\n\r\n - delete invalid print statement.\r\n\r\n- v0.5.0\r\n\r\n - support hybi-13 protocol.\r\n\r\n- v0.4.1\r\n\r\n - fix incorrect custom header order(ISSUE#1)","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
\ No newline at end of file |