@@ -18,7 +18,7 @@ def __init__(self, url, protocols=None, extensions=None, io_loop=None):
1818 def connect (self ):
1919 parts = urlsplit (self .url )
2020 if parts .scheme == "wss" :
21- self .io = iostream .SSLIOStream (self .sock , io_loop )
21+ self .io = iostream .SSLIOStream (self .sock , self . io_loop )
2222 host , port = parts .netloc , 80
2323 if ':' in host :
2424 host , port = parts .netloc .split (':' )
@@ -28,11 +28,11 @@ def __send_handshake(self):
2828 self .io .set_close_callback (self .__connection_closed )
2929 self .io .write (escape .utf8 (self .handshake_request ),
3030 self .__handshake_sent )
31-
31+
3232 def __connection_closed (self , * args , ** kwargs ):
3333 self .server_terminated = True
3434 self .closed (1006 , 'Connection closed during handshake' )
35-
35+
3636 def __handshake_sent (self ):
3737 self .io .read_until ("\r \n \r \n " , self .__handshake_completed )
3838
@@ -45,7 +45,7 @@ def __handshake_completed(self, data):
4545 except HandshakeError :
4646 self .close_connection ()
4747 raise
48-
48+
4949 self .opened ()
5050 self .io .set_close_callback (self .__stream_closed )
5151 self .io .read_bytes (self .reading_buffer_size , self .__fetch_more )
@@ -63,7 +63,7 @@ def __fetch_more(self, bytes):
6363
6464 def __gracefully_terminate (self ):
6565 self .client_terminated = self .server_terminated = True
66-
66+
6767 try :
6868 if not self .stream .closing :
6969 self .closed (1006 )
@@ -92,7 +92,7 @@ def data_provider():
9292 yield "#" * i
9393
9494 self .send (data_provider ())
95-
95+
9696 for i in range (0 , 200 , 25 ):
9797 self .send ("*" * i )
9898
@@ -103,9 +103,9 @@ def received_message(self, m):
103103
104104 def closed (self , code , reason = None ):
105105 ioloop .IOLoop .instance ().stop ()
106-
106+
107107 ws = MyClient ('http://localhost:9000/ws' , protocols = ['http-only' , 'chat' ])
108108 ws .connect ()
109-
109+
110110 ioloop .IOLoop .instance ().start ()
111111
0 commit comments