- give up to support socket io
  - we should handshake with socket io out of this module.
This commit is contained in:
liris
2014-06-26 08:30:37 +09:00
parent 29bdbfe62d
commit 181ca1d8d0
2 changed files with 2 additions and 33 deletions

View File

@@ -44,11 +44,6 @@ Default squid setting is "ALLOWED TO CONNECT ONLY HTTPS PORT".
Current implementation of websocket-client is using "CONNECT" method via proxy. Current implementation of websocket-client is using "CONNECT" method via proxy.
Socket IO support
==================
We have experimental support for socket io 0.9, not 1.0 since websocket client v0.16.0.
This implementation is experimetal and API migth be changed.
expamle:: expamle::
------------- -------------
@@ -158,9 +153,6 @@ example::
ChangeLog ChangeLog
============ ============
- v0.16.0
- experimental support for socket io 0.9 (#91)
- v0.15.0 - v0.15.0
- fixed exception when send a large message (#84) - fixed exception when send a large message (#84)

View File

@@ -210,10 +210,8 @@ def create_connection(url, timeout=None, **options):
sslopt = options.get("sslopt", {}) sslopt = options.get("sslopt", {})
fire_cont_frame = options.get("fire_cont_frame", False) fire_cont_frame = options.get("fire_cont_frame", False)
enable_multithread = options.get("enable_multithread", False) enable_multithread = options.get("enable_multithread", False)
support_socket_io = options.get("support_socket_io", None)
websock = WebSocket(sockopt=sockopt, sslopt=sslopt, websock = WebSocket(sockopt=sockopt, sslopt=sslopt,
fire_cont_frame = fire_cont_frame, enable_multithread=enable_multithread, fire_cont_frame = fire_cont_frame, enable_multithread=enable_multithread)
support_socket_io=support_socket_io)
websock.settimeout(timeout if timeout is not None else default_timeout) websock.settimeout(timeout if timeout is not None else default_timeout)
websock.connect(url, **options) websock.connect(url, **options)
return websock return websock
@@ -330,8 +328,7 @@ class WebSocket(object):
""" """
def __init__(self, get_mask_key=None, sockopt=None, sslopt=None, def __init__(self, get_mask_key=None, sockopt=None, sslopt=None,
fire_cont_frame=False, enable_multithread=False, fire_cont_frame=False, enable_multithread=False):
support_socket_io=None):
""" """
Initalize WebSocket object. Initalize WebSocket object.
""" """
@@ -356,7 +353,6 @@ class WebSocket(object):
self.lock = threading.Lock() self.lock = threading.Lock()
else: else:
self.lock = NoLock() self.lock = NoLock()
self.support_socket_io = support_socket_io
def fileno(self): def fileno(self):
return self.sock.fileno() return self.sock.fileno()
@@ -504,18 +500,6 @@ class WebSocket(object):
return headers, key return headers, key
def _get_handshake_socket_io(self, host, port, resource, resp_headers, **options):
body_length = int(resp_headers['content-length'])
body = self._recv_strict(body_length)
body = body.decode('utf-8')
_dump("response body", body)
sessid, heartbeat, close, transports = body.split(':', 4)
transport = transports.split(',')[0]
resource += transport + '/' + sessid
return self._get_handshake_headers(resource, host, port, options)
def _handshake(self, host, port, resource, **options): def _handshake(self, host, port, resource, **options):
headers, key = self._get_handshake_headers(resource, host, port, options) headers, key = self._get_handshake_headers(resource, host, port, options)
@@ -523,13 +507,6 @@ class WebSocket(object):
self._send(header_str) self._send(header_str)
_dump("request header", header_str) _dump("request header", header_str)
if self.support_socket_io == "0.9":
resp_headers = self._get_resp_headers(200)
headers, key = self._get_handshake_socket_io(host, port, resource, resp_headers, **options)
header_str = "\r\n".join(headers)
self._send(header_str)
_dump("request header", header_str)
resp_headers = self._get_resp_headers() resp_headers = self._get_resp_headers()
success = self._validate_header(resp_headers, key) success = self._validate_header(resp_headers, key)
if not success: if not success: