我刚刚将SignalR中的示例代码翻译成VB.NET,如下所示。当我从客户端调用test
时,Connect
被正确调用,但从不调用服务器端Disconnect
,Reconnect
和$.connection.hub.disconnected
。还有什么我应该做的?我已经使用IE10,Chrome和FF进行了测试。
已编辑:stateChanged
和 Public Class Status
Inherits Hub
Implements IDisconnect
Implements IConnected
Public Function Disconnect() As Threading.Tasks.Task Implements IDisconnect.Disconnect
Return Clients.leave(Context.ConnectionId, DateTime.Now.ToString())
End Function
Public Function Connect() As Threading.Tasks.Task Implements IConnected.Connect
Return Clients.joined(Context.ConnectionId, DateTime.Now.ToString())
End Function
Public Function Reconnect(groups As IEnumerable(Of String)) As Threading.Tasks.Task Implements IConnected.Reconnect
Return Clients.rejoined(Context.ConnectionId, DateTime.Now.ToString())
End Function
Public Sub test()
Stop
End Sub
End Class
正在按预期工作。
{{1}}