I realize that these questions are similar:
SignalR - Broadcast to all clients except Caller
Send a message to all clients in a Group, except for the current cl
Your approach does work, however the correct approach is to use the built in API: Clients.Others.addMessage(message)
. Also there's no need to get the hub context inside the hub itself. You can always access the current connection ID via Context.ConnectionId or send message sto clients via Clients.All.foo();
And you cannot set the ConnectinoID programatically. If you'd like to track users across pages maintain a list of users on your server and then just re-assign the connection id's as they navigate through the site.
Here's a post explaining the tracking of users: SignalR 1.0 beta connection factory