Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR, Limited unique connections (opened tabs) IIS8, Windows8

Tags:

signalr

It is impossible to use SignalR, when several tabs opened with unique ids assigned to each tab (see. When SignalR made 8-10 connections at a time live chat doesn't work).

But. there is a workaround I described in this stackoverflow issue. The idea is to overwrite connectionid in order, that every opened tab would have the same connection id: thus, logicaly, in my particular case, there is no reason to have unique ids for each tab, 'cos each tab is opened by one MyApplicationUserId.

Anyway, it has been noticed in stackoverflow (see SignalR How is a duplicate Connection Id handled? ), that connectionid must be unique. And they say, that IConnectionIdGenerator will be removed in an upcomming release.

So, this is a kind of blind alley. I must use unique ids, but I cannot use SignalR with several browser tabs opened.

Thank you. Dmitry.

like image 405
Dmitry Avatar asked Oct 23 '12 11:10

Dmitry


2 Answers

As has been discussed in the SignalR issue you've opened here, most modern browsers limit the maximum number of concurrent connections (typically around 6) to the same site.

One workaround is to use subdomains, i.e. each tab connects to a different subdomain (this is the approach Facebook is using). Another option would be to start just one connection and use localStorage as a message bus between tabs as suggested by FreshCode in this question: SignalR and Browser Connection limit

like image 163
Alexander Köplinger Avatar answered Sep 23 '22 15:09

Alexander Köplinger


To bypass browser limtation you can use ‛localStorage‛ to communicate between windows and to have only one window as connection owner. Other windows in this case use connection owner to receive/send messages. IWC-SignalR is an implementation of such approach.

like image 21
Eugene Khudoy Avatar answered Sep 22 '22 15:09

Eugene Khudoy