python-websockets / websockets

Library for building WebSocket servers and clients in Python

Home Page:https://websockets.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type hint for websocket connection

paulmis opened this issue · comments

commented

What is the type hint for a websocket connection, i.e. from the example:

async def echo(websocket: ?):
    async for message in websocket:
        await websocket.send(message)

async def main():
    async with serve(echo, "localhost", 8765):
        await asyncio.Future()  # run forever

In case someone else has the same question: websockets.server.WebSocketServeProtocol