Tyk natively supports also GraphQL subscriptions, so you can expose your full range of GQL operations using Tyk Gateway. Subscriptions support was added in
v4.0.0 in which graphql-ws protocol support was introduced.
With the release of Tyk
v4.3.0 the number of supported subscription protocols has been extended.
In Tyk subscriptions are using the WebSocket transport for connections between the client and Gateway. For connections between Gateway and upstream WebSockets or SSE can be used.
Supported transports and protocols
|WebSockets||graphql-ws (default, no longer maintained)|
|HTTP||Server-Sent Events (SSE)|
Connections between client and Gateway currently only supports WebSockets/graphql-ws. See GraphQL WebSockets for more information.
If the upstream subscription GraphQL API is protected please enable the authentication via query params to pass the header through.
There is no need to enable subscriptions separately. They are supported alongside GraphQL as a standard. The only requirement for subscriptions to work is to enable WebSockets in your Tyk Gateway configuration file.
Here’s a general sequence diagram showing how subscriptions in Tyk work exactly: