By Guest on Friday, 19 June 2020
Posted in General
Replies 2
Likes 0
Views 2.8K
Votes 0
Hello, Good evening.

Im trying to use sgcwebsocketClient to connect to graphql endpoint (Hasura endpoint) without any luck , i need to add an extra header to the request "x-hasura-secret: xxx" , im doing in on the OnHandshake event , then add it to Headers , but not working , do you have some example of how to use GraphQL Subscriptions?.


Thanks you, Regards.

my code is attached.
Hi,

I've been able to configure and connect to GraphQL with Authorization. Setting the header in OnHandshake event is correct, you must set there. But GraphQL uses his own protocol, so before you open a websocket connection you must register this protocol in websocket client.

Client.RegisterProtocol('graphql-ws');

Once registered you can open websocket connection.

graphql.png


As shown in screenshot, I can connect and request a query which returns all records of a sample table.

Kind Regards,
Sergio
·
4 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you!! , its working now.
·
4 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post