Aiming at shortages of the traditional technologies for Web real‐time application ,a framework based on SingalR was constructed ,which could handle three real time scenarios .The first was the one way data requirement from client browsers ,the second was that the server side sent update message to other clients after one client executing business logic or changing applica‐tion state ,the last was that the server side pushed data to all clients or specific client by timer interval .The client called server side method through local Hub Proxy ,the result returned to client through the SingalR context .If the server side needed to call client side methods ,it broadcasted the request to the client also through the SingalR context ,so the full duplex communications from server side to client side was realized .The business requirement of the Web real‐time application can be satisfied by the framework ,which is verified by the realization .%针对传统Web实时应用程序实现技术的不足,构建基于SingalR的Web实时应用程序框架。该框架能处理客户端单向数据请求、客户端业务逻辑执行或改变应用程序状态后通知到其它连接的客户端及主动将更新数据定时推送到所有连接客户端或特定客户端这3种场景。客户端通过由SingalR生成的本地 Hub代理类调用服务端方法,结果通过SingalR路由上下文返回到客户端,服务端通过SingalR路由上下文以广播的方式调用客户端代码,实现服务端、客户端之间的全双工通讯。实验结果表明,该框架可以满足Web实时应用程序的业务需求。
展开▼