I want to write PM messaging in my social network and I need to use long pooling requests. The best solution for asp.net is to use SignalR, but here are some problems. That's the way of execution: user writes a message, asp.net controller save it and then we need to invoke interlocutor client method and show the message. But I can choose interlocutor client because I don't know his generated ClientId, and since SignalR version 1.0, I can't implement my own ConnectionIdFactory. What can I do in this situation?
Asked
Active
Viewed 211 times
0
-
When a user connects to SignalR you get a connection id. You will need to create your own mechanism e.g. a dictionary object or database table to keep track of this connection id and the users identity (you can use the User.Identity object if they are logged in). – Steve Apr 15 '13 at 14:50
-
See Detecting connect, reconnect and disconnect clients in Hubs : https://github.com/SignalR/SignalR/wiki/Hubs – Steve Apr 15 '13 at 14:56
-
Yeah, that's the solution, but not too good. – Eriendel Apr 15 '13 at 15:08
-
What exactly is the problem? – Steve Apr 15 '13 at 15:09
-
See : http://stackoverflow.com/questions/14350158/signalr-1-0-beta-connection-factory – Steve Apr 15 '13 at 15:11
-
The problem is, that I don't want to implement such complicated mechanism and I think, that better to write my own substitute of SignalR, based on WebSockets. – Eriendel Apr 15 '13 at 15:14
-
If it's going to just be private messages from user to user, why not use the SignalR groups for each user? Subscribe the client(s) for a given user to their own group and then messages from the other party's client or clients get pushed to that user's group. – UtopiaLtd Apr 15 '13 at 20:16
-
@UtopiaLtd, thank you for answer. I started to use groups, after I learned it. – Eriendel Apr 15 '13 at 20:50