Open
Conversation
…ure it with JWT" This reverts commit fa55515.
…ed for the Subscribe message
This was referenced Oct 22, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reenable subscribe message that was commented in #2 and add proper JWT check.
This closes mozilla#83 and mozilla#86
This is to support use case like 1-5 publishers and 100 listeners for some sort of webinar, see discussion in mozilla#76
This Subscribe message is currently only useful if:
syncOccupantsapi to sync subscriptions to publishers via the newcreateListenerand to not create a publisher connection for you so that all participants don't subscribe automatically to you that make explode the number of connections the server needs to maintain. In the experiment add createListener with the subscribe message naf-janus-adapter#9 I only created thecreateListenerfunction. Also be aware of Ghost avatar in the room after the user auto reconnect (master branch) naf-janus-adapter#21 that is not fixed yet.Having written the above, rewritten the api documentation, reading again my comments on mozilla#76 and knowing that
Subscribemessage is exactly the same asJoinwith{media: UserId}except it doesn't has the listener user_id or room_id, and we don't maintain a list of them in the switchboard.It would be more useful if we do the following changes instead:
Subscribemessage code completely{kind: ["publisher"|"listener"|"subscriber"], data: true, notifications: true}(addJoinKind::Listener)switchboard.join_listener)process_join, if listener, useswitchboard.join_listenerand send to all publishers and listeners{ "event": "join", "kind": "listener", "user_id": user_id, "room_id": room_id }, if publisher, send with the event with"kind": "publisher". In naf janus adapter, you can subscribe to their audio/video if"kind": "publisher", otherwise just maintain a list of listeners or counter of listeners in the room.get_all_userstoget_publishers, add a newget_listenersusers_occupyingsimilar topublishers_occupyingbut return publishers and listenersdata_recipients_for, useusers_occupyinginstead ofpublishers_occupyingprocess_joinresponse send the list of publishers in users array as today + listeners array:{"users:": ["publisherId1", "publisherId2"], "listeners": ["listenerId1", "listenerId2"]}(rename users to publishers if we don't care about backward compatibility, also modify theinitialOccupantsline in the adapter that add those publishers to the available occupants to subscribe)data:trueto detect if the connection is a publisher and look atkind: "publisher"field (we can fallback to usingdata:trueif kind is not defined if we care about backward compatibility)process_dataanddestroy_session(leave event),process_join(join event), instead of usingswitchboard.publishers_occupyinguseswitchboard.users_occupyingthat returns both publishers and listeners. Indestroy_session, add thekind: "publisher"|"listener"field to the leave event. Also probably fix sending the leave event if the main connection is closed and not all connections to fix Ghost avatar in the room after the user auto reconnect (master branch) naf-janus-adapter#21. This way naf adapter can unsubscribe if the participant was publisher, remove the participant for the users list if publisher or listener.{kind: ["publisher"|"listener"]}to switch the main connection to publisher or back to listener, send aswitchevent to all publishers and listeners so they can subscribe if it became a publisher or unsubscribe if it became a listener. (switchboard.switch_to_publisher,switchboard.switch_to_listener)Changes in naf adapter master branch that maintain a separate
availableOccupantsandoccupantslists andsyncOccupantsapi:this.createPublisher()call) with Join messagekind: "listener"orkind: "publisher"createSubscriberto addkind:subscribersendSwitchwith paramkind: "publisher"|"listener"that send theswitchevent.switchevent, more or less treat it like a leave followed by a joinavailableOccupantsto have the information of publisher or listener or two separate arrays.adapter.requestedOccupants = adapter.availableOccupants;, useadapter.requestedOccupants = []and maintain the list of occupants (publishers) you want to subscribe to, for example based on a private audio zone you are in.requestedOccupantsarray and callsyncOccupants(). Note: the callsyncOccupants()in the join handler in the adapter is not really useful here because we don't use an external users list backend and are not callingsyncOccupants(newOccupants)when the users list change.This way, you can use the plugin without any additional backend, you can also choose to keep reliableTransport/unreliableTransport to datachannel or websocket, and keep networked updates and chat on it.
Note: the server still maintain a WebRTC connection for the participant, even if the participant don't use datachannel, audio or video. We can probably remove creation of the datachannels if reliableTransport and unreliableTransport are not set to "datachannel" (this is the default, so meaning you set it to "websocket"), but we still keep a main WebRTC connection with an inactive audio track and an inactive video track.