SplitmediaLabsLimited / xjs

XSplit JS Framework. Make plugins for XSplit Broadcaster, quickly and easily.
Other
39 stars 11 forks source link

Support re-initializing the `sendMessage` method used by Remote #199

Closed ravenjohn closed 6 years ago

ravenjohn commented 6 years ago

xjs only allows setting the sendMessage method on .ready() which means it can only be done once. Since the connection used for sending messages can be replaced. It would be better if xjs allows the sendMessage function to be set again.

xjs.ready({
    remote: {
        type: 'proxy',
        sendMessage: peerConnection.send,
    }
})

Proposed:

xjs.Remote.setSendMessage(peerConnection.send);

Workaround available:

xjs.Remote.sendMessage = peerConnection.send;
virn commented 6 years ago

I'll also be including the method to xjs.Remote.setRemoteType for instances where you need to set the remoteType on the extension to be executed locally, to avoid using the current workaround.

mikeybanez commented 6 years ago

Don't forget to add these changes or additions to the tutorial article about Remote.