- do closing handshake
This commit is contained in:
7
setup.py
7
setup.py
@@ -1,8 +1,11 @@
|
||||
from setuptools import setup
|
||||
|
||||
VERSION = "0.3"
|
||||
|
||||
|
||||
setup(
|
||||
name="websocket-client",
|
||||
version="0.2",
|
||||
version=VERSION,
|
||||
description="WebSocket client for python",
|
||||
long_description=open("README").read(),
|
||||
author="liris",
|
||||
@@ -11,7 +14,7 @@ setup(
|
||||
url="https://github.com/liris/websocket-client",
|
||||
classifiers = [
|
||||
"Development Status :: 3 - Alpha",
|
||||
"License :: OSI Approved :: LGPL License",
|
||||
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
||||
"Programming Language :: Python",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: POSIX",
|
||||
|
12
websocket.py
12
websocket.py
@@ -301,9 +301,14 @@ class WebSocket(object):
|
||||
"""
|
||||
Close Websocket object
|
||||
"""
|
||||
if self.connected and self.version == HYBI00:
|
||||
# TODO: closing handshake
|
||||
pass
|
||||
if self.connected:
|
||||
try:
|
||||
self.sock.send("\xff\x00")
|
||||
result = self._recv(2)
|
||||
if result != "\xff\x00":
|
||||
logger.error("bad closing Handshake")
|
||||
except:
|
||||
pass
|
||||
self.sock.close()
|
||||
|
||||
def _recv(self, bufsize):
|
||||
@@ -334,7 +339,6 @@ class WebSocket(object):
|
||||
|
||||
if __name__ == "__main__":
|
||||
enableTrace(True)
|
||||
#setdefaulttimeout(1)
|
||||
# ws = create_connection("ws://localhost:8080/echo")
|
||||
ws = create_connection("ws://localhost:5000/chat")
|
||||
print "Sending 'Hello, World'..."
|
||||
|
Reference in New Issue
Block a user