autobahn-js icon indicating copy to clipboard operation
autobahn-js copied to clipboard

Run a single WAMP connection on shared Web worker

Open oberstet opened this issue 9 years ago • 3 comments

Scenario: have a single WAMP-WebSocket connection from a Web worker used from multiple tabs.

E.g. when a WAMP call is issued from the JavaScript running in a tab, the call needs to be forwarded to the WAMP connection running in the Web worker. When the result comes back, that result needs to be transmitted from the Web worker to the tab that issued the call.

oberstet avatar Jul 07 '14 15:07 oberstet

What needed to do this changes? is it complicated?

yosiat avatar Dec 24 '14 20:12 yosiat

I've read your blog post on shared workers with lots of interrest. The problems I can see with this approach:

  • Inconsistant behaviour between browser look scary. I am not sure if this changed since your change requests in html5 was approved.
  • webworker require to put the worker code in a separate script, which adds issues with build & minification (thats a minor problem though)

This is why for buildbot, I considered a LocalStorage events approach with master tab election. http://trac.buildbot.net/ticket/3231 Gsoc proposal by @tothandras: https://docs.google.com/document/d/1koiJkqOn532eEY7ojmAzt4vdglxRGMNEsSbm9jZ0hVs/edit

tardyp avatar Mar 20 '15 10:03 tardyp

No idea about the implementation state of things for my proposal - I really should re-run my tests and check.

Regarding your proposal for buildbot: There is no way you can transfer a WebSocket connection to another tab when a tab is closing. The only possibility would be shared Web workers. In the present state should already provide a solution for this - after all, we're talking about staying within the original spec, i.e. that at least one page which uses the shared Web worker remains open at all times. However, a look at the current implementation of this shows that there hasn't been any real progress regarding support - Firefox is now there, but Safari has cancelled it, and Internet Explorer is still nowhere to be seen. Otherwise it was interesting to see your solution - I hadn't known about the storageEvent and just assumed you'd need to poll with something like this.

goeddea avatar Mar 21 '15 10:03 goeddea