feat: WebSocket service for event and connection management

This commit is contained in:
Davidson Gomes
2025-03-06 09:22:02 -03:00
parent 9c22621876
commit ad3d0de564
184 changed files with 29850 additions and 8 deletions

View File

@@ -0,0 +1,38 @@
class SocketIOError(Exception):
pass
class ConnectionError(SocketIOError):
pass
class ConnectionRefusedError(ConnectionError):
"""Connection refused exception.
This exception can be raised from a connect handler when the connection
is not accepted. The positional arguments provided with the exception are
returned with the error packet to the client.
"""
def __init__(self, *args):
if len(args) == 0:
self.error_args = {'message': 'Connection rejected by server'}
elif len(args) == 1:
self.error_args = {'message': str(args[0])}
else:
self.error_args = {'message': str(args[0])}
if len(args) == 2:
self.error_args['data'] = args[1]
else:
self.error_args['data'] = args[1:]
class TimeoutError(SocketIOError):
pass
class BadNamespaceError(SocketIOError):
pass
class DisconnectedError(SocketIOError):
pass