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.
This is a draft of a PR that will ultimately be submitted upstream to
yjs/y-webrtc
Refactors SignalingConn and related code to allow swapping out the signaling server client by extending WebrtcProvider and SignalingConn.
subscribe
,unsubscribe
, andpublish
methods forSignalingConn
so external code doesn't need to know how to format signaling server messages.publishSignalingMessage
so classes derived fromSignalingConn
can make use of it, as well as other parts of y-webrtc.publish
method and refactor other y-webrtc code that calls it?connected
method, since clients may determine signaling server connectivity differently.setupClient
method which can be overridden to use a different signaling server client (ex: Azure Web PubSub client) including differing message event names (ex:message
vsgroup-message
)rooms
iteration into ahandleConnect
method, so that global set does not have to be exported and used in derived classes.handleMessage
method so the logic can be reused and does not need to be included in the clientmessage
event definitions of derived classes.Question
Overriding
WebrtcProvider
just to change the class used for signaling connections seems excessive. Is there a way we can pass this into the base WebrtcProvider instead?This is the only line we need to change in the
connect()
method:const signalingConn = map.setIfUndefined(signalingConns, url, () => new SignalingConn(url))