Skip to content

Should WebSocketConnection be an asynchronous iterator? #29

Open
@mehaase

Description

@mehaase

The connection object could be an iterator that yields incoming messages, i.e. as an alternative to calling get_message().

# simple WebSocket echo
async with open_websocket(…) as websocket:
    async for message in websocket:
        await websocket.send(message)

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions