-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-WebSocket transport alternative? #840
Comments
Hi @jonathanperret, I think it would be very feasible to have a long polling fallback. We kind of expected we'd need one at some point, but the years went by and problems were too few and far between to justify it from our perspective. If you're interested in implementing, I think we could point you in the right direction. |
Hi @paulfitz , this is great to hear. Not promising anything but I'd be interested if you have pointers beyond what a quick scan of the code seems to show, i.e. the only files that seem to manipulate WebSockets directly (outside of tests) are app/server/lib/Comm.ts and app/server/lib/Client.ts for the server, and app/client/components/Comm.ts and app/client/components/GristWSConnection.ts for the client. If this is correct, the area of impact for an alternative transport seems relatively small. An important choice that remains open is the implementation for an alternative to raw WebSockets: a WebSocket emulation layer like https://github.com/sockjs? A full-fledged library like Socket.IO? Or a hand-written long polling implementation? I would love to have your opinion on this. |
@jonathanperret for the code, exactly, you've found the main files involved. It is a very limited part of Grist. I will admit up front that I've found it a somewhat awkward part of Grist to work with, since it is some of the oldest code and has suffered through a lot of evolution. You'll need some patience. On the other hand, I'm excited about the possibility of some clean-up there! For implementation, we're open to tasteful use of well tested libraries that are sufficiently slim on the client side. |
Hello @paulfitz, to give a quick update: I've started looking into this more seriously. Library selectionI looked at the available implementations of HTTP long polling — of which there aren’t many still being developed, since most projects seem to take native WebSocket availability for granted these days. In fact the only recently maintained libraries I could find are the well-known Socket.IO and SockJS. SockJS seemed interesting at first as it is transport-focused (basically emulating WebSocket over other transports), compared to Socket.IO which embeds higher-level functionality such as broadcasting, multiplexing, buffering, acknowledgement, and the abilty to use multiple backends for session management, which I was afraid would be overkill for Grist’s needs. As to the worries I had about the advanced features of Socket.IO overlapping with existing code in Grist, I think they can be assuaged by uisng only the low-level part of Socket.IO which is Engine.IO. This contains only the « transport » part of Socket.IO, i.e. a thin wrapper around The Engine.IO client would add about 24 kilobytes before gzipping (the size of Of note is that the Engine.IO protocol adds some framing even when using native WebSockets, so client and server would have to migrate together even if they end up talking over WebSockets as they currently do. Implementation progressI first started by isolating references to the I then added Engine.IO-using implementations of these classes, together with a switching mechanism based on a The current status is that editing a Grist document seems to work when setting However, I am still struggling a bit to get the tests to pass. The If you want to follow the work in progress, or give early feedback, I’ve been working on a branch here: https://github.com/jonathanperret/grist-core/tree/engine.io (comparison with current |
@jonathanperret great work, that is good research, and your conclusion to use Engine.IO makes sense to me. Thanks for flagging the issue about upgrading client and server in lockstep - that is fine. Glad you are making progress with implementation. Understandable that the tests could be giving trouble. My colleague @dsagal may be able to give some guidance if you need it. Use your own judgment on when to open a draft PR. Doing it earlier rather than later may make it a little easier for Dmitry to chip it. Thanks a lot for working on this! |
Thank you @jonathanperret for digging into this! Regarding
I understand your branch isn't ready to review, but I browsed through it, and noticed an issue in |
Thank you both for the valuable feedback. @dsagal, good catch on The added context for the Unfortunately I have found a subtle bug in Engine.IO while working on this, which causes I’ve gone ahead and opened a draft PR : #859 . I’ll keep it updated as I work, and I suggest we move further discussion of the implementation there. |
Hello,
We'be been trying to onboard potential Grist users that are behind an HTTP proxy which doesn't allow WebSocket traffic (either HTTP/1.1 WebSockets or the new HTTP/2 variant). The exclusion of WebSocket traffic is deliberate on the part of the network administrator, so while we are trying to change their mind, we hold little hope of a change in policy in the short/medium term.
How feasible do you think it would be to support an alternative to WebSockets such as HTTP long polling? I'm willing to look into the implementation but I thought I'd share the idea first.
The text was updated successfully, but these errors were encountered: