Open magestican opened 8 years ago
Hi @magestican - I'm not sure I've quite understood your question but I'll take a crack at it.
The rtc-signal
library will cause the signaller to emit a peer:announce
event whenever an announce message is received (https://github.com/rtc-io/rtc-signal/blob/master/handlers/announce.js).
You can see this in action in rtc-quickconnect
(https://github.com/rtc-io/rtc-quickconnect/blob/master/index.js#L445) where it listens for this event in order to know when to start the process of connecting to a remote peer.
Does that answer your question?
Hey nathan! I was not expecting an answer so this was a placeholder question :D. Well I am refactoring some old code here which used quickconnect 2.8 and currently trying to incorporate all the libraries you guys have written.
Rtc-signal as well as rtc-signaller and rtc-quickconnect are all client side, but rtc-switch is server side and there is no server side library which emits the "announce" event on the server.
rtc-switch is an EventEmitter object right, there is no .emit on that object thats what I am saying, or at least I cant find it, the only thing I can think of is to listen on the "data" event of the peer and manually do rtcSwitch.emit("announce") when the data of the data event contains "/announce".
Hi Bryan,
Thanks for clarifying the question - I wasn't sure whether you were asking about client side stuff, and just happened to be in a server side library issue :)
rtc-switch
actually does already emit an announce
event - any commands (excepted for /to
messages) are actually emitted as an event (see https://github.com/rtc-io/rtc-switch/blob/master/index.js#L63).
So if you want to listen in for announce messages, you can simply use .on('announce, function(payload, peer, sender, data) {
on either an rtc-switch
or an rtc-switchboard
instance.
You can see rtc-switch uses this logic to handle the room assignment at https://github.com/rtc-io/rtc-switch/blob/master/index.js#L117.
Hope that helps.
I see now that the switch parses all the commands and emits them, that was not clear to me, thanks.
I have seen that the signaller will send an /announce command as part of the data event to the server (switchboard) but none of your libraries seem to emit the announce event handler declared on rtc-switch.
Any ideas?