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: dist/src/components/Socket.d.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,13 @@ declare type SocketType = {
18
18
};
19
19
/**
20
20
* @desc Using the initial WebSocket connection, this functional component provides the event listeners for each client's socket connection to allow bilateral communication.
21
-
* @param props ws is the socket that will initiate the connection with the WebSocket server and getUsers, handleReceiveCall, handleAnswer, handleNewIceCandidate, endCall are the functions that are executed upon on each switch case event.
21
+
* @param {object} props
22
+
* @param {string} props.ws the socket that will initiate the connection with the WebSocket server
23
+
* @param props.getUsers the functions that are executed upon on each switch case event.
24
+
* @param props.handleReceiveCall
25
+
* @param props.handleAnswer
26
+
* @param props.handleNewIceCandidate
27
+
* @param props.endCall
22
28
* @returns an empty element when rendered and populates the client's socket connection with event listeners that can handle the offer-answer model and SDP objects being exchanged between peers.
* @desc Using the initial WebSocket connection, this functional component provides the event listeners for each client's socket connection to allow bilateral communication.
11
-
* @param props ws is the socket that will initiate the connection with the WebSocket server and getUsers, handleReceiveCall, handleAnswer, handleNewIceCandidate, endCall are the functions that are executed upon on each switch case event.
11
+
* @param {object} props
12
+
* @param {string} props.ws the socket that will initiate the connection with the WebSocket server
13
+
* @param props.getUsers the functions that are executed upon on each switch case event.
14
+
* @param props.handleReceiveCall
15
+
* @param props.handleAnswer
16
+
* @param props.handleNewIceCandidate
17
+
* @param props.endCall
12
18
* @returns an empty element when rendered and populates the client's socket connection with event listeners that can handle the offer-answer model and SDP objects being exchanged between peers.
Copy file name to clipboardExpand all lines: dist/src/components/VideoCall.d.ts
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,15 @@
1
1
/// <reference types="react" />
2
2
/**
3
-
* @desc Wrapper component containing logic necessary for P2P connections using WebRTC (RTCPeerConnect API + MediaSession API) and WebSockets.
4
-
* Any client can call another thus not all functions are invoked for every user.
5
-
* ws.current.send enqueues the specified messages that need to be transmitted to the server over the WebSocket connection, which we connected in our backend using RTConnect's importable SignalingChannel
6
-
* @param {string} this.props.URL
7
-
* @returns A component that renders two VideoComponents (currently not dynamic), a
3
+
* @desc Wrapper component containing the logic necessary for P2P connections using WebRTC APIs (RTCPeerConnect API + MediaSession API) and WebSockets.
4
+
*
5
+
* Any client can call another client and thus not all functions are invoked for every user.
6
+
*
7
+
* ws.current.send enqueues the specified messages that need to be transmitted to the server over the WebSocket connection and this WebSocket connection is connected to the server by using RTConnect's importable SignalingChannel module.
8
+
*
9
+
* @param {object} props
10
+
* @param {string} props.URL string ws or wss link
11
+
* @param {object} props.mediaOptions video embed attributes
12
+
* @returns A component that renders two VideoComponents
* @desc Wrapper component containing logic necessary for P2P connections using WebRTC (RTCPeerConnect API + MediaSession API) and WebSockets.
46
-
* Any client can call another thus not all functions are invoked for every user.
47
-
* ws.current.send enqueues the specified messages that need to be transmitted to the server over the WebSocket connection, which we connected in our backend using RTConnect's importable SignalingChannel
48
-
* @param {string} this.props.URL
49
-
* @returns A component that renders two VideoComponents (currently not dynamic), a
46
+
* @desc Wrapper component containing the logic necessary for P2P connections using WebRTC APIs (RTCPeerConnect API + MediaSession API) and WebSockets.
47
+
*
48
+
* Any client can call another client and thus not all functions are invoked for every user.
49
+
*
50
+
* ws.current.send enqueues the specified messages that need to be transmitted to the server over the WebSocket connection and this WebSocket connection is connected to the server by using RTConnect's importable SignalingChannel module.
51
+
*
52
+
* @param {object} props
53
+
* @param {string} props.URL string ws or wss link
54
+
* @param {object} props.mediaOptions video embed attributes
55
+
* @returns A component that renders two VideoComponents
//username will store a name the client enters and users (see getUsers) will be updated whenever a user logs in or leaves
58
+
// The username state stores the name the client enters. All users (see getUsers) will be able to see an updated list of all other users whenever a new user logs in or leaves.
// useRef allows our variables to be stored in Immutable Objects and do not force page re-renders when its value is changed
58
-
// The WebSocket connection is made later in useEffect once the component mounts then we render <Socket>, an empty component but adds event listeners to the socket
61
+
// The useRef hook allows our variables to be stored as Immutable Objects and thus they do not force page re-renders when their values are changed.
62
+
// The WebSocket connection is established using the useEffect hook - once the component mounts we then render the Socket component, which adds event listeners that can handle the offer-answer model and SDP objects being exchanged between peers to the socket.
59
63
constws=(0,react_1.useRef)(null);
60
64
constlocalVideo=(0,react_1.useRef)(null);
61
65
constremoteVideo=(0,react_1.useRef)(null);
62
66
constpeerRef=(0,react_1.useRef)(null);
63
67
constotherUser=(0,react_1.useRef)();
64
68
constlocalStream=(0,react_1.useRef)(null);
65
69
constsenders=(0,react_1.useRef)([]);
66
-
//maybe try to use context/reference hooks here for html input elements
67
70
letuserField='';
68
71
letreceiver='';
69
72
// this configuration defines the parameters for how an RTCPeerConnection should be created, also ice trickling is enabled with iceCandidatePoolSize set to a value
Copy file name to clipboardExpand all lines: lib/src/components/Socket.tsx
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,13 @@ type SocketType = {
13
13
14
14
/**
15
15
* @desc Using the initial WebSocket connection, this functional component provides the event listeners for each client's socket connection to allow bilateral communication.
16
-
* @param props ws is the socket that will initiate the connection with the WebSocket server and getUsers, handleReceiveCall, handleAnswer, handleNewIceCandidate, endCall are the functions that are executed upon on each switch case event.
16
+
* @param {object} props
17
+
* @param {string} props.ws the socket that will initiate the connection with the WebSocket server
18
+
* @param props.getUsers the functions that are executed upon on each switch case event.
19
+
* @param props.handleReceiveCall
20
+
* @param props.handleAnswer
21
+
* @param props.handleNewIceCandidate
22
+
* @param props.endCall
17
23
* @returns an empty element when rendered and populates the client's socket connection with event listeners that can handle the offer-answer model and SDP objects being exchanged between peers.
// These interfaces describe the different events that the WebSocket message event to will filter through and the payloads that will be sent to other socket connections via webSocket.
* @desc Wrapper component containing logic necessary for P2P connections using WebRTC (RTCPeerConnect API + MediaSession API) and WebSockets.
34
-
* Any client can call another thus not all functions are invoked for every user.
35
-
* ws.current.send enqueues the specified messages that need to be transmitted to the server over the WebSocket connection, which we connected in our backend using RTConnect's importable SignalingChannel
36
-
* @param {string} this.props.URL
37
-
* @returns A component that renders two VideoComponents (currently not dynamic), a
34
+
* @desc Wrapper component containing the logic necessary for P2P connections using WebRTC APIs (RTCPeerConnect API + MediaSession API) and WebSockets.
35
+
*
36
+
* Any client can call another client and thus not all functions are invoked for every user.
37
+
*
38
+
* ws.current.send enqueues the specified messages that need to be transmitted to the server over the WebSocket connection and this WebSocket connection is connected to the server by using RTConnect's importable SignalingChannel module.
39
+
*
40
+
* @param {object} props
41
+
* @param {string} props.URL string ws or wss link
42
+
* @param {object} props.mediaOptions video embed attributes
43
+
* @returns A component that renders two VideoComponents
//username will store a name the client enters and users (see getUsers) will be updated whenever a user logs in or leaves
46
+
47
+
// The username state stores the name the client enters. All users (see getUsers) will be able to see an updated list of all other users whenever a new user logs in or leaves.
// useRef allows our variables to be stored in Immutable Objects and do not force page re-renders when its value is changed
47
-
// The WebSocket connection is made later in useEffect once the component mounts then we render <Socket>, an empty component but adds event listeners to the socket
51
+
// The useRef hook allows our variables to be stored as Immutable Objects and thus they do not force page re-renders when their values are changed.
52
+
// The WebSocket connection is established using the useEffect hook - once the component mounts we then render the Socketcomponent, which adds event listeners that can handle the offer-answer model and SDP objects being exchanged between peers to the socket.
0 commit comments