Skip to content

Instantly share code, notes, and snippets.

@shortthefomo
Last active October 3, 2024 02:13
Show Gist options
  • Save shortthefomo/def0e2c0afb5696bcc1b292d6da5d6b2 to your computer and use it in GitHub Desktop.
Save shortthefomo/def0e2c0afb5696bcc1b292d6da5d6b2 to your computer and use it in GitHub Desktop.
threexrp public socket
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)
}
}
@shortthefomo
Copy link
Author

shortthefomo commented Jul 25, 2023

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment