我已经尝试了 URI 的所有可能组合,下面是我的代码。当使用网页http://www.websocket.org/echo.html并为“位置:”输入 ws://websocket.mtgox.com/mtgox 时,网页显示了一个不错的流提要。但是当我在下面复制并粘贴他们的示例并为流使用相同的 URI 时,我得到“错误:未定义”和“断开连接”。根据下面的示例,我尝试将其转换为 VB,但没有成功。关于我做错了什么的任何想法?
导入 WebSocket4Net
模块模块1
Sub Main()
Dim websocket As New WebSocket4Net.WebSocket("ws://websocket.mtgox.com:80/mtgox")
Dim stream As String
Console.WriteLine(websocket.State)
Console.ReadKey()
AddHandler websocket.Opened, Sub(s, e) socketOpened()
AddHandler websocket.Error, Sub(s, e) socketError()
AddHandler websocket.Closed, Sub(s, e) socketClosed()
AddHandler websocket.MessageReceived, Sub(s, e) socketMessage()
AddHandler websocket.DataReceived, Sub(s, e) socketDataReceived()
websocket.Open()
Console.ReadKey()
End Sub
Sub socketOpened()
MsgBox("Opened")
End Sub
Sub socketClosed()
MsgBox("Closed")
End Sub
Sub socketError()
MsgBox("Error")
End Sub
Sub socketMessage()
'MsgBox(e)
End Sub
Sub socketDataReceived()
MsgBox("Data received")
End Sub
端模块