A GraphQL API can push new data to the client with the Subscription Type. In this lesson, we’ll listen to checkIn and checkOut mutations in real time.
To follow along with these queries, go to the Pet Library GraphQL Playground.
Having some issues here with the subscription: could not connect to websocket endpoint wss://funded-pet-library.moonhighway.com/.
Looks like the default connections over a websocket with Apollo Server is 10 unless you specify more. I updated the code so that this wouldn't be a problem even if many people are connected. Thanks for the heads up!
Hi @Eve, here Subscriptions are not testable "message": "Cannot read property 'headers' of undefined"
Make sure you are "logged in" and have your token present in the headers. That should resolve the problem! Thanks!
Hi, I am having an issue connecting to websocket from my browser. Getting following error:
{
"error": "Could not connect to websocket endpoint wss://funded-pet-library.moonhighway.com/graphql. Please check if the endpoint url is correct."
}
@Vui I got the same error but went ahead to write the checkOut and checkIn mutations and I got the desired response for the subscription
Hello, Having some issues here with the subscription: { "error": "Could not connect to websocket endpoint wss://funded-pet-library.moonhighway.com/graphql. Please check if the endpoint url is correct." } /* Endpoint: https://funded-pet-library.moonhighway.com/
*/
{ "error": "Could not connect to websocket endpoint wss://pet-library.moonhighway.com/graphql. Please check if the endpoint url is correct." }