You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/rtconnect-test.yml
+2-19Lines changed: 2 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
1
+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node and various OS (Windows, Ubuntu)
2
2
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} # This works BUT it shows up as problem for some unknown reason ("Context access might be invalid: NPM_TOKEN") and there should not be any errors
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} # This works BUT it shows up as problem for some unknown reason ("Context access might be invalid: NPM_TOKEN") and there should not be any errors
* @classdesc The SignalingChannel class, which utilizes WebSockets in order to facillitate communication between clients connected to the WebSocket server.
10
10
* @prop { WebsocketServer } websocketServer - a simple WebSocket server
11
-
* @prop { Map } users - object containing key-value pairs consisting of users' names and their corresponding WebSocket in the following fashion { username1: socket1, username2: socket2, ... , usernameN: socketN }
11
+
* @prop { Map } peers - object containing key-value pairs consisting of peers' names and their corresponding WebSocket in the following fashion { username1: socket1, username2: socket2, ... , usernameN: socketN }
12
12
*/
13
-
14
13
classSignalingChannel{
15
14
webSocketServer: WebSocketServer;
16
-
users: Map<string,WebSocket>;
15
+
peers: Map<string,WebSocket>;
17
16
18
17
/**
19
18
* @constructor constructing a websocket server with an http/https object or port passed in upon instantiating SignalingChannel
20
19
* @param {Server} server - pass in a server (http or https) or pass in a port (this port cannot be the same as the application port and it has to listen on the same port)
// this.rooms = new Map(); //focus on later when constructing 2+ video conferencing functionality, SFU topology
26
25
}
27
26
@@ -36,14 +35,14 @@ class SignalingChannel {
36
35
this.webSocketServer.on('connection',(socket)=>{
37
36
console.log('A user has connected to the websocket server.');
38
37
39
-
// when a client closes their browser or connection to the websocket server (onclose), their socket gets terminated and they are removed from the map of users
38
+
// when a client closes their browser or connection to the websocket server (onclose), their socket gets terminated and they are removed from the map of peers
40
39
// lastly a new user list is sent out to all clients connected to the websocket server.
* @desc Wrapper component containing the logic necessary for peer connections using WebRTC APIs (RTCPeerConnect API + MediaSession API) and WebSockets.
40
40
*
41
-
* ws, localVideo, remoteVideo, peerRef, localStreamRef, otherUser, senders are all mutable ref objects that are created using the useRef hook. The useRef hook allows you to persist values between renders and it is used to store a mutable value that does NOT cause a re-render when updated.
41
+
* ws, localVideoRef, remoteVideo, peerRef, localStreamRef, otherUser, senders are all mutable ref objects that are created using the useRef hook. The useRef hook allows you to persist values between renders and it is used to store a mutable value that does NOT cause a re-render when updated.
42
42
*
43
43
* The WebSocket connection (ws.current) is established using the useEffect hook and once the component mounts, the Socket component is rendered. The Socket component adds event listeners that handle the offer-answer model and the exchange of SDP objects between peers and the socket.
* |<--------------------------|-------------------| Peer B's ICE Candidates are now being trickled in to peer A for connectivity.
64
+
* |-------------------------->|------------------>| ICE Candidates from Peer A, these steps repeat and are only necessary if Peer B can't connect to the
65
+
* | | | | earlier candidates sent.
66
+
* |<--------------------------|-------------------| ICE Candidate trickling from Peer B, could also take a second if there's a firewall to be
67
+
* | | | | circumvented.
68
+
* | | | | Connected! Peer to Peer connection is made and now both users are streaming data to eachother!
69
+
*
70
+
* If Peer A starts a call their order of functions being invoked is... handleOffer --> callUser --> createPeer --> peerRef.current.negotiationNeeded event (handleNegotiationNeededEvent) --> ^send Offer SDP^ --> start ICE trickle, handleIceCandidateEvent --> ^receive Answer^ SDP --> handleIceCandidateMsg --> once connected, handleTrackEvent
71
+
* If Peer B receives a call then we invoke... ^Receive Offer SDP^ --> handleReceiveCall --> createPeer --> ^send Answer SDP^ --> handleIceCandidateMsg --> handleIceCandidateEvent --> once connected, handleTrackEvent
72
+
*
73
+
* Note: Media is attached to the Peer Connection and sent along with the offers/answers to describe what media each client has.
* |<--------------------------|-------------------| Peer B's ICE Candidates are now being trickled in to peer A for connectivity.
124
-
* |-------------------------->|------------------>| ICE Candidates from Peer A, these steps repeat and are only necessary if Peer B can't connect to the
125
-
* | | | | earlier candidates sent.
126
-
* |<--------------------------|-------------------| ICE Candidate trickling from Peer B, could also take a second if there's a firewall to be
127
-
* | | | | circumvented.
128
-
* | | | | Connected! Peer to Peer connection is made and now both users are streaming data to eachother!
129
-
*
130
-
* If Peer A starts a call their order of functions being invoked is... handleOffer --> callUser --> createPeer --> peerRef.current.negotiationNeeded event (handleNegotiationNeededEvent) --> ^send Offer SDP^ --> start ICE trickle, handleIceCandidateEvent --> ^receive Answer^ SDP --> handleIceCandidateMsg --> once connected, handleTrackEvent
131
-
* If Peer B receives a call then we invoke... ^Receive Offer SDP^ --> handleReceiveCall --> createPeer --> ^send Answer SDP^ --> handleIceCandidateMsg --> handleIceCandidateEvent --> once connected, handleTrackEvent
141
+
* @async
142
+
* @function openUserMedia is invoked in the useEffect Hook after WebSocket connection is established.
143
+
* @desc If the localVideoRef.current property exists, openUserMedia invokes the MediaDevices interface getUserMedia() method to prompt the clients for audio and video permission.
132
144
*
133
-
* Note: Media is attached to the Peer Connection and sent along with the offers/answers to describe what media each client has.
145
+
* If clients grant permissions, getUserMedia() uses the video and audio constraints to assign the local MediaStream from the clients' cameras/microphones to the local <video> element.
* @function openUserMedia is invoked in the useEffect Hook after WebSocket connection is established.
188
-
* @desc If the localVideo.current property exists, openUserMedia invokes the MediaDevices interface getUserMedia() method to prompt the clients for audio and video permission.
189
-
*
190
-
* If clients grant permissions, getUserMedia() uses the video and audio constraints to assign the local MediaStream from the clients' cameras/microphones to the local <video> element.
* @function callUser - Constructs a new RTCPeerConnection object using the createPeer function and then adds the local client's (Peer A/caller) media tracks to peer connection ref object.
207
210
* @param {string} userID the remote client's (Peer B/callee) username
localVideo.current.srcObject=stream;// changing local video to display what is being screen shared to the other peer
419
+
localVideoRef.current.srcObject=stream;// changing local video to display what is being screen shared to the other peer
417
420
418
421
screenTrack.onended=function(){// ended event is fired when playback or streaming has stopped because the end of the media was reached or because no further data is available
0 commit comments