MCPcopy Create free account
hub / github.com/abi/screenshot-to-code / WebSocketSetupMiddleware

Class WebSocketSetupMiddleware

backend/routes/generate_code.py:690–704  ·  view source on GitHub ↗

Handles WebSocket setup and teardown

Source from the content-addressed store, hash-verified

688
689
690class WebSocketSetupMiddleware(Middleware):
691 """Handles WebSocket setup and teardown"""
692
693 async def process(
694 self, context: PipelineContext, next_func: Callable[[], Awaitable[None]]
695 ) -> None:
696 # Create and setup WebSocket communicator
697 context.ws_comm = WebSocketCommunicator(context.websocket)
698 await context.ws_comm.accept()
699
700 try:
701 await next_func()
702 finally:
703 # Always close the WebSocket
704 await context.ws_comm.close()
705
706
707class ParameterExtractionMiddleware(Middleware):

Callers 1

stream_codeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected