Client side long polling

98 views
Skip to first unread message

Scott Wittenburg

unread,
Sep 5, 2014, 2:28:41 PM9/5/14
to autob...@googlegroups.com
Hi Tobias,

   The time has come that we need to have some kind of solution for using long polling from the client side.  We are thinking we will implement something ourselves, and we are wondering if you have any pointers for us that could help us make faster progress?  

   I recall you mentioned it was 2 days work for you to implement this in AutobahnJS because you wanted to do some refactoring.  If you think our efforts could support you in this, please let me know.

Cheers,
Scott

Tobias Oberstein

unread,
Sep 10, 2014, 4:37:32 AM9/10/14
to autob...@googlegroups.com
Hi Scott,

Am 05.09.2014 20:28, schrieb Scott Wittenburg:
> Hi Tobias,
>
> The time has come that we need to have some kind of solution for
> using long polling from the client side. We are thinking we will
> implement something ourselves, and we are wondering if you have any
> pointers for us that could help us make faster progress?

The AutobahnPython side of WAMP long-poll is finished. You can test it
in Crossbar using curl as a client as described here:

https://github.com/crossbario/crossbar/wiki/WAMP%20Long-Poll%20Service

I previously started the long-poll in AutobahnJS here

https://github.com/tavendo/AutobahnJS/blob/master/package/lib/longpoll.js

This code works in principle already (I could issue calls, events etc),
but it needs to be refactored into the whole AutobahnJS code base.

I see what I can do the coming days, but I am currently in England for a
week - have to see how much I find time to code ..

Cheers,
/Tobias

>
> I recall you mentioned it was 2 days work for you to implement this
> in AutobahnJS because you wanted to do some refactoring. If you think
> our efforts could support you in this, please let me know.
>
> Cheers,
> Scott
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/b5f7522e-eccd-4e90-9b8f-66ece089efbf%40googlegroups.com
> <https://groups.google.com/d/msgid/autobahnws/b5f7522e-eccd-4e90-9b8f-66ece089efbf%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Scott Wittenburg

unread,
Sep 10, 2014, 1:37:27 PM9/10/14
to autob...@googlegroups.com
Hi Tobias,


On Wednesday, September 10, 2014 2:37:32 AM UTC-6, Tobias Oberstein wrote:
Hi Scott,

Am 05.09.2014 20:28, schrieb Scott Wittenburg:
> Hi Tobias,
>
>     The time has come that we need to have some kind of solution for
> using long polling from the client side.  We are thinking we will
> implement something ourselves, and we are wondering if you have any
> pointers for us that could help us make faster progress?

The AutobahnPython side of WAMP long-poll is finished. You can test it
in Crossbar using curl as a client as described here:

https://github.com/crossbario/crossbar/wiki/WAMP%20Long-Poll%20Service

I previously started the long-poll in AutobahnJS here

https://github.com/tavendo/AutobahnJS/blob/master/package/lib/longpoll.js

This code works in principle already (I could issue calls, events etc),
but it needs to be refactored into the whole AutobahnJS code base.

I see what I can do the coming days, but I am currently in England for a
week - have to see how much I find time to code ..

Hmmm, then maybe we'll try to just get your AutobahnJS repo and work with that.  If we can get that working in our environment, we can probably hold off on developing anything ourselves.

Thanks for the tips!  We'll let you know how it goes :-)

Cheers,
Scott
 
Cheers,
/Tobias

>
>     I recall you mentioned it was 2 days work for you to implement this
> in AutobahnJS because you wanted to do some refactoring.  If you think
> our efforts could support you in this, please let me know.
>
> Cheers,
> Scott
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com

Tobias Oberstein

unread,
Sep 20, 2014, 12:56:47 PM9/20/14
to autob...@googlegroups.com
Hi Scott,

alright, I've added long-poll to AutobahnJS. Still beta, needs more polish.

The long-poll transports works with IE9 (see screenshot).

There are issues left with IE8 (and below), likely due general JS
issues. If you want to help: debugging IE8 and lower would be welcome!

Here is how to test:

1) Update and install latest Crossbar from GitHub master.

2) Clone AutobahnJS repo, checkout "longpoll" branch and build by doing
"make bundle" from repo root.

3) Change to "test/longpoll" in AutobahnJS repo and start crossbar
("crossbar start")

4) Open "http://localhost:8080/" in Chrome, IE10 or IE9. You should see
a transport of type WebSocket or Long-Poll being created and used.

Cheers,
/Tobias
Clipboard03.png

Scott Wittenburg

unread,
Sep 24, 2014, 1:38:44 PM9/24/14
to autob...@googlegroups.com
Hi Tobias,

   Sorry I didn't get back to you right away, I have been away on travel this week.  But this is really fantastic!  Thanks for moving this up in your priority list, I will give it a try as soon as I have a chance.  If I run into any issues or questions, I will let you know.

  Again, I really want to thank you for always being so responsive on this list, and for putting in such great effort to keep the community engaged.  Additionally, I feel you went above and beyond again by implementing the client-side long polling so quickly.  Keep up the great work :-)

Cheers,
Scott

emile.co...@gmail.com

unread,
Oct 3, 2014, 4:41:40 PM10/3/14
to autob...@googlegroups.com
Does this support automatic fallback from WebSockets to long polling, or do you have to choose either WebSockets or long polling when establishing the connection?

Have you considered using a XHR -> WebSocket upgrade approach, instead of WebSocket -> XHR fallback? Socket.io now uses the latter approach, as it avoids timeouts which negatively impact user experience.

Cheers,
Emile

emile.co...@gmail.com

unread,
Oct 6, 2014, 12:07:59 PM10/6/14
to autob...@googlegroups.com
I took a look at the AutobahnJS source code, and I see that one can pass an array of transports to the Connection. When you connect, it traverses that list of transports until one of them works. By passing a WebSocket transport before a Long-Poll transport in the transport array, it will effectively fall back to long polling if the WebSocket connection fails.

Is this interpretation correct?

P.S. Anyone who knows can answer; it doesn't have to be Tobias. :-)
Reply all
Reply to author
Forward
0 new messages