[英]Is it possible to synchronously call Signalr server side method from javascript client?
我想从javascript调用服务器中心方法并使用javascript代码块,直到服务器端方法返回(一些数据)为止-这可能吗?
No. It is not possible to make the SignalR JS client block for hub method invocations. 不可以。无法使SignalR JS客户端块进行集线器方法调用。
The only option is to use the jQuery promise which is returned immediately by SignalR after it starts invoking the hub method. 唯一的选择是使用SignalR在开始调用hub方法后立即返回的jQuery Promise。 The then
, done
, fail
, etc... methods allow you to add handlers that run after the hub invocation has completed. then
, done
, fail
等方法允许您添加在中心调用完成后运行的处理程序。
You can learn more by reading the SignalR Hubs API Guide for the JS client . 您可以阅读JS客户端的SignalR Hubs API指南,了解更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.