sok.server.events
The events of the server, sent live to the browsers (GET /api/events).
Each browser tab that listens gets a queue; publish() puts an event in all of them. An event is a dict with a "type", such as {"type": "scan", ...}.
EventBus
class EventBus()Hands every published event to every listener.
Sourcelistenersproperty
int
publish
def publish(event: Dict[str, Any]) -> None:Send an event; called from the event loop of the server.
Parameters
| Name | Type | Description |
|---|---|---|
event | Dict[str, Any] |
subscribe
def subscribe() -> asyncio.Queue:unsubscribe
def unsubscribe(queue: asyncio.Queue) -> None:Parameters
| Name | Type | Description |
|---|---|---|
queue | asyncio.Queue |
Attributes
| Name | Value |
|---|---|
QUEUE_SIZE | 100 |