src_backend/socket.js
/**
 * updates the code at roomId to the new code, and broadcasts this change to all other users in the room
 * @param {SocketIO.Socket} socket socket server connection
 * @param {string} roomId the roomId
 * @param {string} newCode the new code
 */
updates the code at roomId to the new code, and broadcasts this change to all other users in the room
@param {SocketIO.Socket} socket socket server connection
@param {string} roomId the roomId
@param {string} newCode the new code
updates the code at roomId to the new code and broadcasts this change to all other users in the room @param { SocketIO . Socket } socket socket server connection @param { string } roomId the roomId @param { string } newCode the new code
function broadcastCodeHandler (socket, roomId, newCode) {
  if (isInvalidRoomId(roomId) || isInvalidJavaCode(newCode)) {
    console.error(
      `attempted broadcast of invalid room or code: 
      ${roomId} 
      ${newCode}`
    )
    socket.disconnect(true)
  } else {
    roomData.set(roomId, newCode).catch(err => console.error(err))
    socket.broadcast.to(roomId).emit('sync code', { newCode })
  }
}
function broadcastCodeHandler ( socket , roomId , newCode ) { if ( isInvalidRoomId ( roomId ) || isInvalidJavaCode ( newCode ) ) { console . error ( ` ${ roomId } ${ newCode } ` ) socket . disconnect ( true ) } else { roomData . set ( roomId , newCode ) . catch ( err => console . error ( err ) ) socket . broadcast . to ( roomId ) . emit ( 'sync code' , { newCode } ) } }
updates the code at roomId to the new code, and broadcasts this change to all other users in the room
 @param {SocketIO.Socket} socket socket server connection
 @param {string} roomId the roomId
 @param {string} newCode the new code
updates the code at roomId to the new code and broadcasts this change to all other users in the room @param { SocketIO . Socket } socket socket server connection @param { string } roomId the roomId @param { string } newCode the new code