Transform CallProvider into 'CallManager' hook, review WebSocket messages for calls
- These changes allowed to remove more cascading effects. It is now possible to reactivate StrictMode. Downside is we lost the 'optional context' of CallProvider: the call logic will be loaded even if there is no call.
- The WebSocket messages have been changed so the client does not have to know the conversation members before a call. Previously, the client had to fetch the conversation members for a call, which was causing cascading effects.
- Accidentally, moving the handling of conversation members to the server added some logic for calls with more than two participants, but it is still not ready to work.
* CallProvider.tsx will be renamed in next commit in order to make it easier to track its file history
Change-Id: Iae711009adafce065ac3defc1c91c7ca0f37898c
diff --git a/common/src/enums/websocket-message-type.ts b/common/src/enums/websocket-message-type.ts
index 238f443..b2d729c 100644
--- a/common/src/enums/websocket-message-type.ts
+++ b/common/src/enums/websocket-message-type.ts
@@ -20,10 +20,18 @@
ConversationRequest = 'conversation-request',
ConversationView = 'conversation-view',
ComposingStatus = 'composing-status',
- CallBegin = 'call-begin',
- CallAccept = 'call-accept',
- CallEnd = 'call-end',
- WebRtcOffer = 'webrtc-offer',
- WebRtcAnswer = 'webrtc-answer',
- WebRtcIceCandidate = 'webrtc-ice-candidate',
+
+ // calls (in the order they should be sent)
+ sendCallInvite = 'sendCallInvite',
+ onCallInvite = 'onCallInvite',
+ sendCallExit = 'sendCallExit', // can be sent anytime after invite
+ onCallExit = 'onCallExit',
+ sendCallJoin = 'sendCallJoin',
+ onCallJoin = 'onCallJoin',
+ sendWebRtcOffer = 'sendWebRtcOffer',
+ onWebRtcOffer = 'onWebRtcOffer',
+ sendWebRtcAnswer = 'sendWebRtcAnswer',
+ onWebRtcAnswer = 'onWebRtcAnswer',
+ sendWebRtcIceCandidate = 'sendWebRtcIceCandidate',
+ onWebRtcIceCandidate = 'onWebRtcIceCandidate',
}