Skip to content

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.

Source

listenersproperty

int

publish

def publish(event: Dict[str, Any]) -> None:

Send an event; called from the event loop of the server.

Parameters

NameTypeDescription
eventDict[str, Any]
Source

subscribe

def subscribe() -> asyncio.Queue:
Source

unsubscribe

def unsubscribe(queue: asyncio.Queue) -> None:

Parameters

NameTypeDescription
queueasyncio.Queue
Source

Attributes

NameValue
QUEUE_SIZE100
Built with Kiln