我试着用下面的代码在ropsten testnet上使用它,但是我从来没有从服务器获得任何消息。0x websocket不支持ropsten吗,或者我的代码有什么问题吗?= 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)
}非常感谢你的支持
发布于 2021-09-20 17:45:22
谢谢您的问题:) 0xWebSocketAPI目前只支持mainnet。您的代码适用于'wss://api.0x.org/sra/v4'。
https://ethereum.stackexchange.com/questions/110263
复制相似问题