@@ -47,7 +47,7 @@ Emit. ::
4747
4848 from socketIO_client_nexus import SocketIO, LoggingNamespace
4949
50- with SocketIO('localhost ', 8000, LoggingNamespace) as socketIO:
50+ with SocketIO('127.0.0.1 ', 8000, LoggingNamespace) as socketIO:
5151 socketIO.emit('aaa')
5252 socketIO.wait(seconds=1)
5353
@@ -58,7 +58,7 @@ Emit with callback. ::
5858 def on_bbb_response(*args):
5959 print('on_bbb_response', args)
6060
61- with SocketIO('localhost ', 8000, LoggingNamespace) as socketIO:
61+ with SocketIO('127.0.0.1 ', 8000, LoggingNamespace) as socketIO:
6262 socketIO.emit('bbb', {'xxx': 'yyy'}, on_bbb_response)
6363 socketIO.wait_for_callbacks(seconds=1)
6464
@@ -78,7 +78,7 @@ Define events. ::
7878 def on_aaa_response(*args):
7979 print('on_aaa_response', args)
8080
81- socketIO = SocketIO('localhost ', 8000, LoggingNamespace)
81+ socketIO = SocketIO('127.0.0.1 ', 8000, LoggingNamespace)
8282 socketIO.on('connect', on_connect)
8383 socketIO.on('disconnect', on_disconnect)
8484 socketIO.on('reconnect', on_reconnect)
@@ -110,7 +110,7 @@ Define events in a namespace. ::
110110 print('on_aaa_response', args)
111111 self.emit('bbb')
112112
113- socketIO = SocketIO('localhost ', 8000, Namespace)
113+ socketIO = SocketIO('127.0.0.1 ', 8000, Namespace)
114114 socketIO.emit('aaa')
115115 socketIO.wait(seconds=1)
116116
@@ -129,7 +129,7 @@ Define standard events. ::
129129 def on_disconnect(self):
130130 print('[Disconnected]')
131131
132- socketIO = SocketIO('localhost ', 8000, Namespace)
132+ socketIO = SocketIO('127.0.0.1 ', 8000, Namespace)
133133 socketIO.wait(seconds=1)
134134
135135Define different namespaces on a single socket. ::
@@ -146,7 +146,7 @@ Define different namespaces on a single socket. ::
146146 def on_aaa_response(self, *args):
147147 print('on_aaa_response', args)
148148
149- socketIO = SocketIO('localhost ', 8000)
149+ socketIO = SocketIO('127.0.0.1 ', 8000)
150150 chat_namespace = socketIO.define(ChatNamespace, '/chat')
151151 news_namespace = socketIO.define(NewsNamespace, '/news')
152152
@@ -159,11 +159,11 @@ Connect via SSL (https://github.com/invisibleroads/socketIO-client/issues/54). :
159159 from socketIO_client_nexus import SocketIO
160160
161161 # Skip server certificate verification
162- SocketIO('https://localhost ', verify=False)
162+ SocketIO('https://127.0.0.1 ', verify=False)
163163 # Verify the server certificate
164- SocketIO('https://localhost ', verify='server.crt')
164+ SocketIO('https://127.0.0.1 ', verify='server.crt')
165165 # Verify the server certificate and encrypt using client certificate
166- socketIO = SocketIO('https://localhost ', verify='server.crt', cert=(
166+ socketIO = SocketIO('https://127.0.0.1 ', verify='server.crt', cert=(
167167 'client.crt', 'client.key'))
168168
169169Specify params, headers, cookies, proxies thanks to the `requests <http://python-requests.org >`_ library. ::
@@ -172,7 +172,7 @@ Specify params, headers, cookies, proxies thanks to the `requests <http://python
172172 from base64 import b64encode
173173
174174 SocketIO(
175- 'localhost ', 8000,
175+ '127.0.0.1 ', 8000,
176176 params={'q': 'qqq'},
177177 headers={'Authorization': 'Basic ' + b64encode('username:password')},
178178 cookies={'a': 'aaa'},
@@ -182,7 +182,7 @@ Wait forever. ::
182182
183183 from socketIO_client_nexus import SocketIO
184184
185- socketIO = SocketIO('localhost ', 8000)
185+ socketIO = SocketIO('127.0.0.1 ', 8000)
186186 socketIO.wait()
187187
188188Don't wait forever. ::
@@ -191,7 +191,7 @@ Don't wait forever. ::
191191 from socketIO_client_nexus import SocketIO
192192
193193 try:
194- socket = SocketIO('localhost ', 8000, wait_for_connection=False)
194+ socket = SocketIO('127.0.0.1 ', 8000, wait_for_connection=False)
195195 socket.wait()
196196 except ConnectionError:
197197 print('The server is down. Try again later.')
0 commit comments