• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

.gitignoreD22-Nov-202356 97

LICENSED22-Nov-202325.8 KiB507418

README.chromiumD22-Nov-2023654 2116

README.rstD22-Nov-20234.2 KiB190125

websocket.pyD22-Nov-202327.2 KiB894726

README.chromium

1Name: Python websocket-client
2Short Name: websocket-client
3URL: https://github.com/liris/websocket-client
4Version: 0.13.0
5Revision: 7d3a2e7c2b2ebf534039988f4f7bcc599b9e4d0e
6Date: Tue Oct 15 07:44:01 2013 +0900
7License: LGPL-2.1
8License File: NOT_SHIPPED
9Security Critical: no
10
11Description:
12
13websocket-client module is WebSocket client for python. This provide the low
14level APIs for WebSocket. All APIs are the synchronous functions.
15
16Used by the python code in devtools-auto to communicate with a running Chrome instance.
17
18Local Modifications:
19None. However, test, example and packaging code from the upstream repository has
20not been copied downstream.
21

README.rst

1=================
2websocket-client
3=================
4
5websocket-client module  is WebSocket client for python. This provide the low level APIs for WebSocket. All APIs are the synchronous functions.
6
7websocket-client supports only hybi-13.
8
9License
10============
11
12 - LGPL
13
14Installation
15=============
16
17This module is tested on only Python 2.7.
18
19Type "python setup.py install" or "pip install websocket-client" to install.
20
21This module does not depend on any other module.
22
23How about Python 3
24===========================
25
26py3( https://github.com/liris/websocket-client/tree/py3 ) branch is for python 3.3. Every test case is passed.
27If you are using python3, please check it.
28
29Example
30============
31
32Low Level API example::
33
34    from websocket import create_connection
35    ws = create_connection("ws://echo.websocket.org/")
36    print "Sending 'Hello, World'..."
37    ws.send("Hello, World")
38    print "Sent"
39    print "Reeiving..."
40    result =  ws.recv()
41    print "Received '%s'" % result
42    ws.close()
43
44If you want to customize socket options, set sockopt.
45
46sockopt example:
47
48    from websocket import create_connection
49    ws = create_connection("ws://echo.websocket.org/".
50                            sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),) )
51
52
53JavaScript websocket-like API example::
54
55  import websocket
56  import thread
57  import time
58
59  def on_message(ws, message):
60      print message
61
62  def on_error(ws, error):
63      print error
64
65  def on_close(ws):
66      print "### closed ###"
67
68  def on_open(ws):
69      def run(*args):
70          for i in range(3):
71              time.sleep(1)
72              ws.send("Hello %d" % i)
73          time.sleep(1)
74          ws.close()
75          print "thread terminating..."
76      thread.start_new_thread(run, ())
77
78
79  if __name__ == "__main__":
80      websocket.enableTrace(True)
81      ws = websocket.WebSocketApp("ws://echo.websocket.org/",
82                                  on_message = on_message,
83                                  on_error = on_error,
84                                  on_close = on_close)
85      ws.on_open = on_open
86
87      ws.run_forever()
88
89
90wsdump.py
91============
92
93wsdump.py is simple WebSocket test(debug) tool.
94
95sample for echo.websocket.org::
96
97  $ wsdump.py ws://echo.websocket.org/
98  Press Ctrl+C to quit
99  > Hello, WebSocket
100  < Hello, WebSocket
101  > How are you?
102  < How are you?
103
104Usage
105---------
106
107usage::
108  wsdump.py [-h] [-v [VERBOSE]] ws_url
109
110WebSocket Simple Dump Tool
111
112positional arguments:
113  ws_url                websocket url. ex. ws://echo.websocket.org/
114
115optional arguments:
116  -h, --help                           show this help message and exit
117
118  -v VERBOSE, --verbose VERBOSE    set verbose mode. If set to 1, show opcode. If set to 2, enable to trace websocket module
119
120example::
121
122  $ wsdump.py ws://echo.websocket.org/
123  $ wsdump.py ws://echo.websocket.org/ -v
124  $ wsdump.py ws://echo.websocket.org/ -vv
125
126ChangeLog
127============
128
129- v0.12.0
130
131  - support keep alive for WebSocketApp(ISSUE#34)
132  - fix some SSL bugs(ISSUE#35, #36)
133  - fix "Timing out leaves websocket library in bad state"(ISSUE#37)
134  - fix "WebSocketApp.run_with_no_err() silently eats all exceptions"(ISSUE#38)
135  - WebSocketTimeoutException will be raised for ws/wss timeout(ISSUE#40)
136  - improve wsdump message(ISSUE#42)
137  - support fragmentation message(ISSUE#43)
138  - fix some bugs
139
140- v0.11.0
141
142  - Only log non-normal close status(ISSUE#31)
143  - Fix default Origin isn't URI(ISSUE#32)
144  - fileno support(ISSUE#33)
145
146- v0.10.0
147
148  - allow to set HTTP Header to WebSocketApp(ISSUE#27)
149  - fix typo in pydoc(ISSUE#28)
150  - Passing a socketopt flag to the websocket constructor(ISSUE#29)
151  - websocket.send fails with long data(ISSUE#30)
152
153
154- v0.9.0
155
156  - allow to set opcode in WebSocketApp.send(ISSUE#25)
157  - allow to modify Origin(ISSUE#26)
158
159- v0.8.0
160
161  - many bug fix
162  - some performance improvement
163
164- v0.7.0
165
166  - fixed problem to read long data.(ISSUE#12)
167  - fix buffer size boundary violation
168
169- v0.6.0
170
171  - Patches: UUID4, self.keep_running, mask_key (ISSUE#11)
172  - add wsdump.py tool
173
174- v0.5.2
175
176  - fix Echo App Demo Throw Error: 'NoneType' object has no attribute 'opcode  (ISSUE#10)
177
178- v0.5.1
179
180  - delete invalid print statement.
181
182- v0.5.0
183
184  - support hybi-13 protocol.
185
186- v0.4.1
187
188  - fix incorrect custom header order(ISSUE#1)
189
190