在 WampSharp 中启动连接时如何发送命令

How to send a command when connecting started in WampSharp

我遇到了这个问题Can't connect to Poloniex .我想我找到了 。我需要在打开连接时发送命令。像这样。

from websocket import create_connection
import json

ws = create_connection("wss://api2.poloniex.com:443")
ws.send('{"command" : "subscribe", "channel" : 1001}')

while True:
    result = ws.recv()
    json_result = json.loads(result)
    if len(json_result) >= 3:
        print(json_result)

ws.close()

但它编码 Python。我怎样才能在 WampSharp 中制作它?

WampSharp 是 WAMP 协议的库。您附加的代码不使用 WAMP 协议,而是使用不同的自定义 WebSocket 子协议。因此,无法使用 WAMP 库使用此服务。