开发者

SignalR - how to detect disconnected clients

开发者 https://www.devze.com 2023-04-10 21:50 出处:网络
How to detect which clients wa开发者_Go百科s disconnected? I\'m using Hub and saw the chat example where the IDisconnect interface was implemented. De Disconnect() function is called when a page is re

How to detect which clients wa开发者_Go百科s disconnected? I'm using Hub and saw the chat example where the IDisconnect interface was implemented. De Disconnect() function is called when a page is refreshed or closed, for example. It's working ok, but how to detect which one was disconnected ?


There's a Client id property on the Hub (Context.ClientId) that you can use to figure out which client disconnected.

0

精彩评论

暂无评论...
验证码 换一张
取 消