Create map to link the networkId to the muteCoreId
In the mute-core project :
We removed the id attribute in the ICollaborator
interface. In the EmitUpdate
function in the CollaboratorsService
class, we removed the id as it is no longer used.
We modified the names of the variable senderId
and recipientId
as senderNetworkId
and recipientNetworkId
to clearly states that it is the networkId
used in the network part of mute.
The networkId is now only stored as a key in the collaborators
map in the CollaboratorsService
class. (As opposed to before when it was basically both the id of the ICollaborator
and the key to the collaborators
map)
In the mute project :
-
network.service.ts
Created anIdMap
class, that stores two maps,networkIdToMuteCoreIdMap
andmuteCoreIdToNetworkIdMap
. With function to set and unset value to both of the maps, and getters.
TheIdMap
is initialized in theNetwork.service.ts
class.
There is also atempNetworkId
cariable in thenetwork.service.ts
class. -
rich-collaborators.service.ts
Replaced theid
by anetworkId
. In the constructor, added a parameter to get thenetworkId
.
Replaced every instance of theid
of aRichCollaborator
bynetworkId
.
Replaced every instance ofsenderId
andrecipientId
bysenderNetworkId
andrecipientNetworkId
(to be on-par with what's used in mute-core)
Added aNetworkService
class variable. This way, the IdMap is accessible. The network is set in thedoc.service.ts
class, before setting up the collaborator's subscriptions.
The RichCollaborator
, the collaborator used in mute, has a networkId
attribute, whereas the ICollaborator
, the collaborator used in mute-core has a muteCoreId
attribute)
Setting values in the IdMap is done by this process :
In the doc.service
class. a subscription is made on the network.onMemberJoin
observable. Whenever this observable is updated, we update the network.tempNetworkId
by the value updated (this observable is updated everytime a peer joins the webgroup).
In the rich-collaborators.service
class, we can get the ICollaborator.muteCoreId
. We get it in the subscribeTo
functions as these function use muteCore observable.
Fixes #27 (closed)