Last active
December 1, 2019 23:33
-
-
Save jjgonecrypto/59fbb8bb1448c95160149c4b6aa8c27b to your computer and use it in GitHub Desktop.
Synthetix subgraph websocket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const WebSocket = require('ws'); | |
const client = new WebSocket('wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges', [ | |
'graphql-ws', | |
]); | |
client.on('open', () => { | |
console.log('open'); | |
client.send(JSON.stringify({ id: 123, type: 'GQL_CONNECTION_INIT' })); | |
// client.send(' subscription { synthExchanges { id } }'); | |
}); | |
client.on('message', data => console.log('message', data)); | |
client.on('close', () => console.log('close')); | |
client.on('error', err => { | |
console.log('error', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment