From 83dea7505112b0f424de825ab05ecbf87bd2138a Mon Sep 17 00:00:00 2001 From: liris Date: Fri, 2 May 2014 15:17:39 +0900 Subject: Create gh-pages branch via GitHub --- index.html | 113 ++++++++++++++++++++++++++++++------------------------------ params.json | 2 +- 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/index.html b/index.html index 8a2fce2..9ad1040 100644 --- a/index.html +++ b/index.html @@ -88,60 +88,60 @@ Default squid setting is "ALLOWED TO CONNECT ONLY HTTPS PORT".

Low Level API example::

-
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()
+
    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()
 

If you want to customize socket options, set sockopt.

sockopt example:

-
from websocket import create_connection
-ws = create_connection("ws://echo.websocket.org/".
-                        sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),) )
+
    from websocket import create_connection
+    ws = create_connection("ws://echo.websocket.org/".
+                            sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),) )
 

JavaScript websocket-like API example::

-
import websocket
-import thread
-import time
+
    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()
 

@@ -151,37 +151,38 @@ if __name__ == "__main__":

sample for echo.websocket.org::

-

$ wsdump.py ws://echo.websocket.org/ - Press Ctrl+C to quit

- -
-

Hello, WebSocket +

  $ wsdump.py ws://echo.websocket.org/
+  Press Ctrl+C to quit
+  > Hello, WebSocket
   < Hello, WebSocket
-How are you?
-  < How are you?

-
+ > How are you? + < How are you? +

Usage

-

usage:: - wsdump.py [-h] [-v [VERBOSE]] ws_url

+
usage::
+
+  wsdump.py [-h] [-v [VERBOSE]] ws_url
 
-

WebSocket Simple Dump Tool

+WebSocket Simple Dump Tool -

positional arguments: - ws_url websocket url. ex. ws://echo.websocket.org/

+positional arguments: + ws_url websocket url. ex. ws://echo.websocket.org/ -

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

+ -v VERBOSE, --verbose VERBOSE set verbose mode. If set to 1, show opcode. If set to 2, enable to trace websocket module +

example::

-

$ wsdump.py ws://echo.websocket.org/ +

  $ wsdump.py ws://echo.websocket.org/
   $ wsdump.py ws://echo.websocket.org/ -v
-  $ wsdump.py ws://echo.websocket.org/ -vv

+ $ wsdump.py ws://echo.websocket.org/ -vv +

ChangeLog

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 -- cgit v1.2.1