I have a comet application that bases on Erlang's gen_server and it works pretty well when used with different browsers but when I open multiple tabs of a page with the same browser, call to .yaws file takes a while to complete, with more than 6 tabs it doesn't even deliver messages until closing half of the tabs, though other browser are functioning normally and from the other browser are delivered almost instantly.
The application is too complex to add here to diagnose, Comet/long polling must be delaying the execution of the .yaws file but how??? It must has something to do with the yaws session, these are the tests I made... i opened 6 tabs on Opera, Chrome, Firefox plus their incognitos and signed in as 6 different users and it is functioning very well which I think gen_server is performing normally. Now I close all browser and reopen one browser plus its incognito, When I open 3 tabs on browser A and one tab on Browser B (which is incognito of the browser A) when I send a message from Browser B to A all tabs receive messages as expected but when I send message from Browser A to B it takes a while when I open 6 or more tabs messages are not sent even after 10 minutes, since long polling performs its tasks normally i think this, somehow causing the problem.
I have been trying figure out this problem for days and finally I found the same issue in yaws examples.
Just open the link below on 7 or more tabs then check out the last opened tab as you go
=> http://yaws.hyber.org/server_sent_events.html
You will notice that the server doesn't respond as expected which is exactly the same problem I am having with long_polling
How do I overcome this problem?
This isn't an issue with Yaws, but rather is a browser limitation on the number of server-sent events (SSE) connections you can have to a single IP address. Some browsers allow you to configure higher limits and some don't, which means if you're required to use SSE or long polling, you're pretty much stuck with those limits and will have to devise a way for your application to work within them.
You might consider using websocket instead, as browsers handle those connections differently and so they're not subjected to the same strict limits.