[英]SignalR doesn't reach JS client function
I can successfully call testFunc() on my server. 我可以在服务器上成功调用testFunc()。 But the Invoke simply never gets to my testFuncCallback() function.
但是Invoke根本无法进入我的testFuncCallback()函数。 Since I can call the server, the connection appears to be fine.
由于我可以呼叫服务器,因此连接似乎正常。 Any idea what's going on?
知道发生了什么吗?
BACKEND: BACKEND:
[HubName("testHub")]
public class testHub: Hub
{
public void testFunc()
{
Clients.Caller.Invoke("testFuncCallback");
}
}
JS: JS:
$scope.lTestHub = $scope.$parent.signalrConnection.testHub;
$scope.lTestHub.on('testFuncCallback', function () {
alert("jo");
});
$scope.lTestHub.server.testFunc();
Change the line 换线
$scope.lTestHub.on('testFuncCallback', function () {
to 至
$scope.lTestHub.client('testFuncCallback', function () {
That should do it. 那应该做。
See simple example here: http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr 在此处查看简单的示例: http : //www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.