Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 633 Bytes

websocket.md

File metadata and controls

31 lines (22 loc) · 633 Bytes

Web Socket

xCallScan enables one-way socket connections, allow the client side to subscribe to new messages in real time.

URLs

  • Mainnet: wss://xcallscan.xyz/ws
  • Testnet: wss://testnet.xcallscan.xyz/ws

Examples

Html

const ws = new WebSocket('wss://xcallscan.xyz/ws')
ws.addEventListener('message', function (event) {
    console.log(event.data)
})

Nodejs

https://www.npmjs.com/package/ws

import WebSocket from 'ws'
const ws = new WebSocket('wss://xcallscan.xyz/ws')
ws.on('message', function message(data) {
    console.log('received', JSON.parse(data.toString()))
})