Skip to content

Alternatives for communication for broader support #38

Open
@kayvanbree

Description

@kayvanbree

I've read something about other techniques to do cross-window communication. Something like this. Using a method like that would eliminate the need for polling, theoretically making the communication quicker. I have never used it though. Also, I don't know about browser support and I think 3/4 of the library would have to be rewritten.

This person had the same problem and they recommend using a BroadcastChannel. It's a simple API:

// Setup
var bc = new BroadcastChannel('test_channel');

// Broadcasting
bc.postMessage('This is a test message.');

// Receiving
bc.onmessage = function (ev) { console.log(ev); }

// Closing connection 
bc.close()

Problem is, Edge doesn't support it yet, so it's of no use for this issue. I did find a polyfill that could maybe work. It uses local storage though, so I don't know if that will work.

[edit] There's another BroadcastChannel 'polyfill' right here. This one chooses the best mode of communication based on the browser it's running on. Works on Edge, FireFox, Chrome, Opera, but it doesn't seem to work on IE11 (which I would abandon altogether). Maybe this would be a better method than pure localStorage? It's pretty damn quick.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions