Soumojitshome2023 / nextjs-videocall-webapp

https://soumojit-nextjs-videocall-webapp.vercel.app/
8 stars 31 forks source link

Issues with Socket.io Server Implementation #55

Open BaibhavTiwari opened 2 weeks ago

BaibhavTiwari commented 2 weeks ago
  1. Socket Initialization CORS Configuration:

    • The CORS configuration is set to cors: true, which is insufficient for complex cross-origin setups. A more specific configuration is needed.
  2. Broadcasting Events to All Clients (io.emit):

    • io.emit is used to broadcast events to all clients instead of targeting specific ones. This leads to unnecessary emissions.
  3. Unnecessary and Unused Variables (RoomU1, RoomU2):

    • Variables like RoomU1 and RoomU2 are commented out and unused, cluttering the code.
  4. Missing Disconnect Handling:

    • There is no handling for disconnect events, which could lead to resource leaks or improperly handled socket disconnections.
  5. Inconsistent Room Management:

    • Room management is incomplete. Socket.io’s built-in room handling (socket.join() and socket.leave()) is not being used effectively.
  6. Memory Leaks Due to Multiple Connections:

    • Without proper disconnect handling, multiple connections could lead to memory leaks or excessive socket instances.
  7. No Error Handling for Invalid Data:

    • There is no error handling for invalid or missing data in events like Send_RoomJoin_Req, which could result in undefined behavior.
  8. Event Key Naming Conflicts:

    • Object keys such as to and from in events like Send_Offer and Send_Ans may cause confusion and need better naming conventions.
Soumojitshome2023 commented 1 week ago

Best of luck