Friday, 19 June 2020
  2 Replies
  2.4K Visits
  Subscribe
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.
Attachments (1)
3 years ago
·
#437
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
Attachments (1)
3 years ago
·
#438
Thank you!! , its working now.
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf
· Insert · Remove
  Upload Files (Maximum 10MB)