Router Configuration for Subscriptions
This section explains how you can configure Subscriptions both for local development and using Cosmo Studio.
When using Subscriptions with Cosmo Router locally or through Cosmo Studio, you'd need to configure the correct protocol to talk to your Subgraphs. Cosmo Router Supports WebSockets as well as the SSE (Server-Sent Events) for transport. When using WebSockets, the Router automatically negotiates with the Subgraph what protocol to use. The protocols "graphql-ws" and "graphql-transport-ws" are both supported.
Configure Subscriptions for local development
When composing a Graph locally, you can supply the protocol using the following configuration.
If your Subgraph uses SSE, use the following configuration.
If your Subgraph uses SSE over HTTP POST, the config should look like this.
If your Subscriptions Endpoint differs from the default routing URL, you can use the following configuration.
Configure Subscriptions using wgc
When using Cosmo Studio as a target to publish your Subgraphs, you'll be using "wgc publish" to upload the Subgraph configuration to the Studio. In this case, you can supply the protocol using the following config.
Setting a custom Subscriptions protocol on wgc publish
Available options are "sse", "sse_post", and "ws".
Setting a custom Subscriptions URL on wgc publish
You can also use `wgc subgraph update ...` to update the Subscriptions protocol or URL for a specific Subgraph.
Last updated