Closed xFalkoN closed 9 years ago
Hi @xFalkoN
the problem is related with the number of opened connections to the same host, each browser has a different limit.
The right way of subscribe to multiple channels is connecting to all of them on the same request. Since you are using the pushstream.js this can be done with the following code.
function refresh()
{
var pushstream = new PushStream({
host: PushServerHost,
timeout: 300000,
modes: "longpolling",
onmessage: updateWidget
});
for(var i = 0; i <ChanelKeys.length; i++){
pushstream.addChannel(ChanelKeys[i]);
}
pushstream.connect();
}
When the connect method is called it will compose a url like /lp/ch1/ch2/ch3 ... and will deal with the received messages and reconnection for you.
Thank you for the quick and complete answer.
Hi, first of all let me thank you for this great module. I have problem with getting messages in different tabs across browsers. I open 3 tabs in Google Chrome(38.0.2125.111 (64-bit)) and 3 tabs in Mozila Fire Fox (33.0 Mozila for ubuntu). There are 4 long-polling subscruber channels for each tabs. When i push one message in each channel i get next situation:
In first tab of each browsers i get messages of all channels , second tab only 1-2 channels get message and other tabs still pending.
My conf:
I use your pustream.js lib for client
function refresh() { var pushstream = []; for(var i = 0; i <ChanelKeys.length; i++){ pushstream[i] = new PushStream({ host: PushServerHost, timeout: 300000, modes: "longpolling" }); pushstream[i].onmessage = updateWidget; pushstream[i].addChannel(ChanelKeys[i]); pushstream[i].connect(); } } ChanelKeys = array of chanels ids.
Thanks in advance for your help.