Refactoring SimplePeer code: splitting Peer instantiation into 2 subclasses (VideoPeer and ScreenSharingPeer). This leads to way leaner code.
This commit is contained in:
parent
894f7c8009
commit
27ffb6b13d
7 changed files with 307 additions and 176 deletions
|
@ -290,7 +290,10 @@ export class IoSocketController {
|
|||
console.warn("While exchanging a WebRTC signal: client with id ", data.receiverId, " does not exist. This might be a race condition.");
|
||||
return;
|
||||
}
|
||||
return client.emit(SockerIoEvent.WEBRTC_SIGNAL, data);
|
||||
return client.emit(SockerIoEvent.WEBRTC_SIGNAL, {
|
||||
userId: socket.userId,
|
||||
signal: data.signal
|
||||
});
|
||||
}
|
||||
|
||||
emitScreenSharing(socket: ExSocketInterface, data: unknown){
|
||||
|
@ -305,7 +308,10 @@ export class IoSocketController {
|
|||
console.warn("While exchanging a WEBRTC_SCREEN_SHARING signal: client with id ", data.receiverId, " does not exist. This might be a race condition.");
|
||||
return;
|
||||
}
|
||||
return client.emit(SockerIoEvent.WEBRTC_SCREEN_SHARING_SIGNAL, data);
|
||||
return client.emit(SockerIoEvent.WEBRTC_SCREEN_SHARING_SIGNAL, {
|
||||
userId: socket.userId,
|
||||
signal: data.signal
|
||||
});
|
||||
}
|
||||
|
||||
searchClientByIdOrFail(userId: string): ExSocketInterface {
|
||||
|
|
|
@ -7,7 +7,6 @@ export const isSignalData =
|
|||
|
||||
export const isWebRtcSignalMessageInterface =
|
||||
new tg.IsInterface().withProperties({
|
||||
userId: tg.isString,
|
||||
receiverId: tg.isString,
|
||||
signal: isSignalData
|
||||
}).get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue