simulstream.server.websocket_server.connection_handler_factory
- simulstream.server.websocket_server.connection_handler_factory(speech_processor_pool: SpeechProcessorPool) Callable[[ServerConnection], Awaitable[None]]
Factory function that creates a connection handler for the WebSocket server.
The returned connection handler routine will process audio and metadata messages sent by a single client over WebSocket.
The handler receives client data (raw audio chunks and textual metadata) and forwards it to a message processor using a speech processor retrieved form the pool of the available ones. If no speech processor is available for the configured waiting time, the client connection is closed. The handler also sends incremental processing results back to the client in JSON format.
- Parameters:
speech_processor_pool (SpeechProcessorPool) – Pool of speech processors to use to handle client connections.
- Returns:
- An asynchronous
WebSocket connection handler coroutine.
- Return type:
Callable[[websockets.asyncio.server.ServerConnection], Awaitable[None]]