Last active
October 3, 2024 02:13
-
-
Save shortthefomo/def0e2c0afb5696bcc1b292d6da5d6b2 to your computer and use it in GitHub Desktop.
threexrp public socket
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
const socketURL = 'wss://three-dev.panicbot.xyz' | |
const socket = new WebSocket(socketURL) | |
socket.onopen = function (message) { | |
//connection string | |
socket.send(JSON.stringify({ | |
op: 'subscribe', | |
channel: 'threexrp' | |
})) | |
// a simple ping needs to be sent, to keep the connection alive. | |
setInterval(function() { | |
socket.send(JSON.stringify({ op: 'ping' })) | |
}, 5000) | |
console.log("Connected to threexrp! :)") | |
socket.onmessage = function (message) { | |
const data = JSON.parse(message.data) | |
if (data.trade != undefined) { | |
console.log('fiat trade', data.trade) | |
} | |
if (data.stable != undefined) { | |
console.log('stable trade', data.stable) | |
} | |
if (data.others != undefined) { | |
console.log('others trade', data.others) | |
} | |
} | |
socket.onerror = function (message) { | |
console.log('error', message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the exchange names correspond to the raw name value off xrpscan API via this
name.replace(/\s+/g, '-').toLowerCase()
xrpscan API ~ 'https://api.xrpscan.com/api/v1/names/well-known'