Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Baddhizm opened this issue Nov 12, 2021 · 0 comments
Open

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

Baddhizm opened this issue Nov 12, 2021 · 0 comments

Comments

@Baddhizm
Copy link

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"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant