@@ -51,7 +51,7 @@ Emit. ::
5151
5252 from socketIO_client import SocketIO, LoggingNamespace
5353
54- with SocketIO('localhost ', 8000, LoggingNamespace) as socketIO:
54+ with SocketIO('127.0.0.1 ', 8000, LoggingNamespace) as socketIO:
5555 socketIO.emit('aaa')
5656 socketIO.wait(seconds=1)
5757
@@ -62,7 +62,7 @@ Emit with callback. ::
6262 def on_bbb_response(*args):
6363 print('on_bbb_response', args)
6464
65- with SocketIO('localhost ', 8000, LoggingNamespace) as socketIO:
65+ with SocketIO('127.0.0.1 ', 8000, LoggingNamespace) as socketIO:
6666 socketIO.emit('bbb', {'xxx': 'yyy'}, on_bbb_response)
6767 socketIO.wait_for_callbacks(seconds=1)
6868
@@ -82,7 +82,7 @@ Define events. ::
8282 def on_aaa_response(*args):
8383 print('on_aaa_response', args)
8484
85- socketIO = SocketIO('localhost ', 8000, LoggingNamespace)
85+ socketIO = SocketIO('127.0.0.1 ', 8000, LoggingNamespace)
8686 socketIO.on('connect', on_connect)
8787 socketIO.on('disconnect', on_disconnect)
8888 socketIO.on('reconnect', on_reconnect)
@@ -114,7 +114,7 @@ Define events in a namespace. ::
114114 print('on_aaa_response', args)
115115 self.emit('bbb')
116116
117- socketIO = SocketIO('localhost ', 8000, Namespace)
117+ socketIO = SocketIO('127.0.0.1 ', 8000, Namespace)
118118 socketIO.emit('aaa')
119119 socketIO.wait(seconds=1)
120120
@@ -133,7 +133,7 @@ Define standard events. ::
133133 def on_disconnect(self):
134134 print('[Disconnected]')
135135
136- socketIO = SocketIO('localhost ', 8000, Namespace)
136+ socketIO = SocketIO('127.0.0.1 ', 8000, Namespace)
137137 socketIO.wait(seconds=1)
138138
139139Define different namespaces on a single socket. ::
@@ -150,7 +150,7 @@ Define different namespaces on a single socket. ::
150150 def on_aaa_response(self, *args):
151151 print('on_aaa_response', args)
152152
153- socketIO = SocketIO('localhost ', 8000)
153+ socketIO = SocketIO('127.0.0.1 ', 8000)
154154 chat_namespace = socketIO.define(ChatNamespace, '/chat')
155155 news_namespace = socketIO.define(NewsNamespace, '/news')
156156
@@ -163,11 +163,11 @@ Connect via SSL (https://github.com/invisibleroads/socketIO-client/issues/54). :
163163 from socketIO_client import SocketIO
164164
165165 # Skip server certificate verification
166- SocketIO('https://localhost ', verify=False)
166+ SocketIO('https://127.0.0.1 ', verify=False)
167167 # Verify the server certificate
168- SocketIO('https://localhost ', verify='server.crt')
168+ SocketIO('https://127.0.0.1 ', verify='server.crt')
169169 # Verify the server certificate and encrypt using client certificate
170- socketIO = SocketIO('https://localhost ', verify='server.crt', cert=(
170+ socketIO = SocketIO('https://127.0.0.1 ', verify='server.crt', cert=(
171171 'client.crt', 'client.key'))
172172
173173Specify params, headers, cookies, proxies thanks to the `requests <http://python-requests.org >`_ library. ::
@@ -176,7 +176,7 @@ Specify params, headers, cookies, proxies thanks to the `requests <http://python
176176 from base64 import b64encode
177177
178178 SocketIO(
179- 'localhost ', 8000,
179+ '127.0.0.1 ', 8000,
180180 params={'q': 'qqq'},
181181 headers={'Authorization': 'Basic ' + b64encode('username:password')},
182182 cookies={'a': 'aaa'},
@@ -186,7 +186,7 @@ Wait forever. ::
186186
187187 from socketIO_client import SocketIO
188188
189- socketIO = SocketIO('localhost ', 8000)
189+ socketIO = SocketIO('127.0.0.1 ', 8000)
190190 socketIO.wait()
191191
192192Don't wait forever. ::
@@ -195,7 +195,7 @@ Don't wait forever. ::
195195 from socketIO_client import SocketIO
196196
197197 try:
198- socket = SocketIO('localhost ', 8000, wait_for_connection=False)
198+ socket = SocketIO('127.0.0.1 ', 8000, wait_for_connection=False)
199199 socket.wait()
200200 except ConnectionError:
201201 print('The server is down. Try again later.')
0 commit comments