[Question] How to get payload on connect in aiohttp
还没有人认领这个 Issue。
评估
调研方向
从使用 graphql_ws.aiohttp.AiohttpSubscriptionServer 和 subscriptions(request) 入口点的 aiohttp 示例开始。跟踪 connection_init 消息的处理方式,并记录其 payload 在 request_context 中可用的位置;当示例展示如何访问 {"FOO":"BAR"} 时即完成。
由索引模型根据 Issue 内容生成。
描述
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"}}
- 主要语言
- Python
- 星标
- 270
- 派生
- 85
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
graphql-python/graphql-ws 的其他 Issue
-
难度 5/5 一周以上 新手友好度 20/100
graphql-python/graphql-ws#95 · 1 个 reaction ·
-
graphql-ws-next 未关闭
难度 5/5 一周以上 新手友好度 20/100
graphql-python/graphql-ws#90 · 4 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
graphql-python/graphql-ws#89 ·
-
难度 4/5 3-5 天 新手友好度 35/100
graphql-python/graphql-ws#84 · 6 条评论 · 3 个 reaction ·
-
难度 5/5 一周以上 新手友好度 18/100
graphql-python/graphql-ws#66 · 8 条评论 · 2 个 reaction ·
查看 graphql-python/graphql-ws 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·