In our previous blog, we announced the availability of subscriptions on StepZen's Docker image and showed the subscription server integrated into a local Docker image. We continue to optimize subscriptions and today we are announcing that subscriptions are available on the StepZen cloud service.

Subscriptions in StepZen

Any query in StepZen can be converted into a subscription. For example:

type Query {
    foo: Foo!
    @rest (endpoint: "...")
}
type Subscription {
    fooSub: Foo! @materializer (query:"foo")
}

That's it! foo can be a @rest query, a @dbquery query, a federated @graphql query, or an @sequence. Any way you construct your queries, each and every one of them can be converted into a subscription! Under the hood, StepZen does long polling to determine what has changed.

See our previous blog to learn how the subscription server integrates into the local docker image. This blog describes how things work on StepZen's managed cloud.

A simple example using StepZen's managed cloud service

An example of subscriptions in StepZen is available in StepZen's examples repo. Clone the repo:

git clone git@github.com:stepzen-dev/subscription-blog.git

and follow the instructions in README.md for the StepZen service.

For the StepZen managed service, the GraphQL subscription server and the GraphQL query server are both managed StepZen cloud services accessed through the WSS and HTTPS schemes respectively. The GraphQL subscription server leverages the previously existing GraphQL server.

When the client application creates a secure Websocket-based subscription using the StepZen managed service at stepzen.net, it connects to one of our subscription servers.

Subscriptions in the subscriptions server are specified using the query argument in the @materializer directive.

All queries that flow from the subscription server to the query servers are subject to the same processing as queries coming from any other client. So, you can be assured that your rulesets will operate. You will see the usage in the dashboard, etc.

Because all of this runs in the StepZen managed cloud service, it scales automatically as needed.

What's Next?

Subscriptions work is ongoing on our roadmap. We'll follow up with blogs and docs as updates to the subscription service roll out. Meanwhile, join our Discord community to stay in-the-know and we'd love to hear what subscription use cases you might have.