MCPcopy Create free account
hub / github.com/miguelgrinberg/python-socketio / wait

Method wait

src/socketio/client.py:177–195  ·  view source on GitHub ↗

Wait until the connection with the server ends. Client applications can use this function to block the main thread during the life of the connection.

(self)

Source from the content-addressed store, hash-verified

175 self.connected = True
176
177 def wait(self):
178 """Wait until the connection with the server ends.
179
180 Client applications can use this function to block the main thread
181 during the life of the connection.
182 """
183 while True:
184 self.eio.wait()
185 self.sleep(1) # give the reconnect task time to start up
186 if not self._reconnect_task:
187 if self.eio.state == 'connected': # pragma: no cover
188 # connected while sleeping above
189 continue
190 else:
191 # the reconnect task gave up
192 break
193 self._reconnect_task.join()
194 if self.eio.state != 'connected':
195 break
196
197 def emit(self, event, data=None, namespace=None, callback=None):
198 """Emit a custom event to the server.

Callers 15

connectMethod · 0.45
callMethod · 0.45
_handle_reconnectMethod · 0.45
emitMethod · 0.45
emitMethod · 0.45
callMethod · 0.45
receiveMethod · 0.45
callMethod · 0.45
callMethod · 0.45

Calls 1

sleepMethod · 0.95

Tested by 3