0

I try to use it on ropsten testnet with below code but i never get any message from the server. Does 0x websocket not support ropsten, or is anything wrong in my code? const socket = W3CWebSocket('wss://ropsten.api.0x.org/sra/v4')

const msg = {
    "type": "subscribe",
    "channel": "orders",
    "makerToken" : "0xc778417e063141139fce010982780140aa0cd5ab",
    "takerToken" : "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
    "requestId": "123e4567-e89b-12d3-a456-426655440000"
  }
  socket.onopen = () => {
    console.log('Web socket client connected');
    socket.send(JSON.stringify(msg));
  }
  
  socket.onmessage = ({data}) => {
    console.log('msg from server', data)
  }

Thanks a lot for your support

1 Answer 1

1

Thanks for your question :) The 0x Websocket API currently only supports mainnet. Your code works fine for 'wss://api.0x.org/sra/v4'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.