Juniper: Subscriptions cannot be multiplexed over one websocket

Created on 17 Jul 2020  路  1Comment  路  Source: graphql-rust/juniper

Describe the bug
Multiple subscriptions should be possible over one WebSocket connection, however the best I can prove this does not work with the Juniper implementation.

To Reproduce
Steps to reproduce the behavior:

Using the warp_subscriptions example you can set up a websocket connection in a Dev Tools console:

var ws = new WebSocket('ws://127.0.0.1:8080/subscriptions', 'graphql-ws')
ws.onmessage = (a) => console.log(a) 
ws.send(JSON.stringify({"type":"connection_init","payload":{}}))
ws.send(JSON.stringify({"id":"1","type":"start","payload":{"variables":{},"extensions":{},"operationName":null,"query":"subscription {\n users {\n id \n}\n}"}}))
ws.send(JSON.stringify({"id":"2","type":"start","payload":{"variables":{},"extensions":{},"operationName":null,"query":"subscription {\n users {\n name \n}\n}"}}))

In other frameworks (tested in Node) this begins streaming messages for each subscription id:

{"type":"data","id":"1","payload":{"data":{"users":{"id":1}}} }
{"type":"data","id":"2","payload":{"data":{"users":{"name":"stream user"}}} }
{"type":"data","id":"1","payload":{"data":{"users":{"id":2}}} }

but in Juniper only the first subscription appears to work:

{"type":"data","id":"1","payload":{"data":{"users":{"id":1}}} }
{"type":"data","id":"1","payload":{"data":{"users":{"id":2}}} }
{"type":"data","id":"1","payload":{"data":{"users":{"id":3}}} }

Expected behavior

I expect multiple subscriptions to be possible over a single websocket connection.

Additional context

I'm using the master branch.

bug

Most helpful comment

I believe https://github.com/graphql-rust/juniper/pull/707 fixed this on master. Please confirm!

>All comments

I believe https://github.com/graphql-rust/juniper/pull/707 fixed this on master. Please confirm!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

teymour-aldridge picture teymour-aldridge  路  5Comments

hrbigelow picture hrbigelow  路  5Comments

spacemeowx2 picture spacemeowx2  路  5Comments

davidpdrsn picture davidpdrsn  路  5Comments

thedodd picture thedodd  路  5Comments