This is a simple simulative video chat application which uses websocket protocol for commmunication between client and server.
- Extract the zip file and VideoChatApp folder in
- Open 2 terminal (bash or powershell)
- In the first terminal
- Run npm i
- Run npm run dev (if you want to serve directly from typescript) or npm run start ( Compiles it to javascript and start app from dist folder)
- In the second terminal
- cd client
- npm i
- npm run start
- After this node server will be running at port 4000 and react client running at port 3000 be default.
- Open a WebBrowser and Goto localhost:3000
- You can see a meeting created with meetingId (some uuid) Click on the meeting link . You will redirected to localhost:3000/meeting/{meetingId}
- First User joined will be host and You can see only one participant intially and his name will Host.
- Now you can copy the meeting link localhost:3000/meeting/{meetingId} and open it in different tabs .
- You can see no.of user joining increases propotional to the number of tabs being opened.
- If you close the browser/refresh the browser/ click on call end button It is considered as user left the meeting .In case of refreshing the browser new joins in place of left user it will be reflected in all tabs.
- You can enable audio/video individually for each user. Correspondingly Button displayed will changed.
- The host view will be different from rest of participants view .Mainly with respect to the count timers being shown.
- Once the host click on any one of the timers (15/30/45) ,the corresponding timer will start on each of the tabs including the host tab and when counter reaches 0 ,an audio will be played.
- Existing timer will be overwritten by new timer as selected by host.
- There is volumeoff button which act as muteAll button for host .Once host clicks on that button ,the mic button of each of the participants will be turned off except the host.
- If any of the participants including the host leave the meeting by clicking end button he will redirected to meetingEnded page localhost:3000/meeting/meetingEnded.
- Finallly If host leave the meeting by any of the above mentioned manner in (11) ,all the remaining participants in the meeting will be disconnected from the meeting and redirected to localhost:3000/meeting/meetingEnded
- You can as many room as you like by going to localhost:3000 and enter the room by going to localhost:3000/meeting/{meetingId}.Each room will act independently.
- API
- There are 2 api endpoints.
- / To generate a meetingId from server.
- /{meetingId} To check whether meeting data exists or not.
- All meeting data are stored in Object indexed by roomId/meetingId.
- All the user data are stored in a Map indexed by socket irrespective of roomId.
- There are 6 events emitted by client and recevied at server end:
- getUsers(roomId :string) - To get the list of user in the given roomId.
- timer(roomId :string , counter:number) - To start the timer at each of participants with particular counter. Emitted by host only.
- userJoined(user: any, roomId: string) - Emitted once new user join the meeting.
- muteAll(roomId:any) - To mute all participants in the room with roomId . Emitted by host only.
- disconnect - InBuilt event emmited any one of the participant leave the meeting.
- connect_error - InBuilt event emmited when any connection error occur.
- There are 2 api endpoints.
- UI
- There are 5 components.
- route '/' - App Component.
- route 'meeting/meetingEnded' - Leftmeeting Component.
- route 'meeting/{meetingId}' - Combination of 3 Components with Meeting as parent and ParticipantView and Host as Childen
- Meeting Component
- UI Emitted Event - userJoined(user: any, roomId: string)
- Host Component
- UI Emitted Events - explained each in api side
- getUsers
- muteAll
- timer
- disconnect
- UI Captured Events
- user - To add the user once user joined the meeting
- startTimer - To start the timer.
- deleteUser - - To remove the user once user left the meeting
- UI Emitted Events - explained each in api side
- ParticipantView
- UI Emitted Events - explained each in api side
- getUsers
- disconnect
- UI Captured Events (First 3 are same as in Host Component)
- user
- startTimer
- deleteUser
- muteClient - To mute the client as requested by the host
- hostdisconnected - To inform participants that host left the meeting .So meeting has ended. As a result all paricipants will be disconnected from the given room.
- UI Emitted Events - explained each in api side
- There are 5 components.
- UI of both host view /participant View can be improved a lot.
- Can create a build of client and can serve both client and server from the same port.
- Actual Integration of Video/ Audio.
- Strict TypeScript Enforcements.
- Proper Logging of each of the events.
- Modularizing/Structuring of client components and enhance the reusability of code.
- Overall Design architecture of each pages can be improved independently.
- Modularizing of API Component.
- User Authentication for uniquely identifying the user can be incorporated.
- Exception Handling.
- Permanent Fix for multi audio Issue. Error 'DOMException: play() failed because the user didn't interact with the document first.'
- Js Doc comments for each function
- Pipeline Integration and deployment.