multiplexing question (does it work as expected?)

10 views
Skip to first unread message

Vasya Novikov

unread,
Aug 31, 2015, 12:45:36 PM8/31/15
to lif...@googlegroups.com
Hi Lift community! I wonder: is the current behavior of multiplexing
expected?:

* open a first tab with: http://demo.liftweb.net/
* open the same page on a second tab

Check out network console. What I see is 3-5 requests per second with
empty contents.

What is happening? Is this really the expected behavior?
I first found it out on my own site, thinking this is a
misconfiguration.. But it happens on the official Lift demo, too.

// I'm sorry if that's a popular question, please point me in the right
direction if I should just read some previous mailing list topic.


--
Vasya Novikov

Antonio Salazar Cardozo

unread,
Aug 31, 2015, 2:47:26 PM8/31/15
to Lift, n1m5-goo...@yandex.ru
Multiplexing has a few different components, but I'm guessing you're asking
about multiplexing over the same connection to the server. Two tabs/windows
cannot currently easily share connections in browsers. As such, if there are
two tabs open, they must have independent connections to the server—even
though these connections may ultimately communicate with a single CometActor
instance.

Additionally, if multiple CometActors are referenced on one page, they
communicate through one connection to the server.

Now, to your observed behavior. Browsers have a limit on the number of
connections they may have to the same host. That limit varies by browser.
Lift keeps track of connections per session; in cases where a session is
trying to maintain more comet connections than the browser would support
having simultaneously, Lift serializes the long-poll connections into short-
poll connections. This means a lot of requests with no response data, but
it ensures that if, say, you open another tab, you will still be able to load it
normally.

That said, this shouldn't kick in at just two tabs unless you're using a browser
we don't recognize properly. I believe we default to serializing early, but if
we recognize the browser as one that supports many connections, we pay
attention to that number of connections.
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages