What does “OperationContext.Current.GetCallbackChannel” actually do?

懵懂的女人 提交于 2019-11-30 20:20:40

When the service receives a call, OperationContext.Current.GetCallbackChannel returns a channel to just that caller. It does not return a channel that broadcasts to all of the clients.

From your question, it's possible that you are only storing the callback that was retrieved in the last call. You actually have to store a list, containing each unique callback instance that has been retrieved. Every time a method is called, you add the callback instance to this list. When you want to broadcast, you have to iterate through each item in the list and make the necessary call.

If your service uses the Singleton instance mode, the implementation object can store a list of callback instances as a data member. If your sevice uses the Client or SingleCall instance mode, then you could have a global object that contains the list of callback instances.

You have to configurate your service to create separated thread for each session. Take a look to http://msdn.microsoft.com/en-us/library/cc681240.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!