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

Method start_background_task

src/socketio/server.py:439–454  ·  view source on GitHub ↗

Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param target: the target function to execute. :param

(self, target, *args, **kwargs)

Source from the content-addressed store, hash-verified

437 return self.eio.handle_request(environ, start_response)
438
439 def start_background_task(self, target, *args, **kwargs):
440 """Start a background task using the appropriate async model.
441
442 This is a utility function that applications can use to start a
443 background task using the method that is compatible with the
444 selected async mode.
445
446 :param target: the target function to execute.
447 :param args: arguments to pass to the function.
448 :param kwargs: keyword arguments to pass to the function.
449
450 This function returns an object that represents the background task,
451 on which the ``join()`` methond can be invoked to wait for the task to
452 complete.
453 """
454 return self.eio.start_background_task(target, *args, **kwargs)
455
456 def sleep(self, seconds=0):
457 """Sleep for the requested amount of time using the appropriate async

Callers 2

_handle_eventMethod · 0.95

Calls

no outgoing calls

Tested by 1