43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Any, Self, Optional, Sequence
|
|
from abc import ABC, abstractmethod
|
|
from Abstracts.WebSocketsServerAbstract import WebSocketsServerAbstract
|
|
from Application.Event import Event
|
|
|
|
class WebSocketsServerManagerInterface(ABC):
|
|
|
|
def __init__(self:Self, anp:Any, inputs:Optional[dict[str, Any|None]|Sequence[Any|None]] = None) -> None:
|
|
self.on_new_client:Event = None
|
|
self.on_message:Event = None
|
|
self.on_close:Event = None
|
|
self.on_error:Event = None
|
|
|
|
@abstractmethod
|
|
def update(self:Self) -> None:pass
|
|
|
|
@abstractmethod
|
|
def reset(self:Self) -> None:pass
|
|
|
|
@abstractmethod
|
|
def close(self:Self) -> None:pass
|
|
|
|
@abstractmethod
|
|
def add(self:Self, inputs:Any|None, overwrite:bool = False) -> None:pass
|
|
|
|
@abstractmethod
|
|
def remove(self:Self, names:str|Sequence[str]) -> None:pass
|
|
|
|
@abstractmethod
|
|
def get(self:Self, name:str) -> WebSocketsServerAbstract|None:pass
|
|
|
|
@abstractmethod
|
|
def send(self:Self,
|
|
name:str,
|
|
controller:str,
|
|
method:str,
|
|
data:Optional[Any] = None,
|
|
clients:Optional[int|Sequence[int]] = None,
|
|
code:int = 200
|
|
) -> None:pass |