Skip to content

[Question] How to get payload on connect in aiohttp #87

@Baddhizm

Description

@Baddhizm

simple example:

from graphql_ws.aiohttp import AiohttpSubscriptionServer
from .schema import schema

subscription_server = AiohttpSubscriptionServer(schema)


async def subscriptions(request):
    ws = web.WebSocketResponse(protocols=('graphql-ws',))
    await ws.prepare(request)
    # payload = request.get('payload') ???
    await subscription_server.handle(ws, request_context=payload)
    return ws


app = web.Application()
app.router.add_get('/subscriptions', subscriptions)

web.run_app(app, port=8000)

How to get payload when init connection to socket?

{"type":"connection_init","payload":{"FOO":"BAR"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions