Skip to content
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

Isnt the switchboard supposed to emit the peer /announce commands as announce to rtc-switch? #25

Open
magestican opened this issue Feb 29, 2016 · 4 comments

Comments

@magestican
Copy link

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?

@nathanoehlman
Copy link
Contributor

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?

@magestican
Copy link
Author

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".

@nathanoehlman
Copy link
Contributor

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.

@magestican
Copy link
Author

I see now that the switch parses all the commands and emits them, that was not clear to me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants