src_backend/socket.js
/**
 * updates the correct cursor at roomId to the new position, 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} color the cursor color
 * @param { line: number, ch: number } cursor the cursor position
 */
updates the correct cursor at roomId to the new position, 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} color the cursor color
@param { line: number, ch: number } cursor the cursor position
updates the correct cursor at roomId to the new position 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 } color the cursor color @param { line : number ch : number } cursor the cursor position
function broadcastCursorHandler (socket, roomId, color, cursor) {
  if (isInvalidRoomId(roomId)) {
    console.error(
      `attempted broadcast of invalid room: 
      ${roomId}`
    )
    socket.disconnect(true)
  } else {
    socket.broadcast.to(roomId).emit('cursor move', { color, cursor })
  }
}
function broadcastCursorHandler ( socket , roomId , color , cursor ) { if ( isInvalidRoomId ( roomId ) ) { console . error ( ` ${ roomId } ` ) socket . disconnect ( true ) } else { socket . broadcast . to ( roomId ) . emit ( 'cursor move' , { color , cursor } ) } }
updates the correct cursor at roomId to the new position, 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} color the cursor color
 @param { line: number, ch: number } cursor the cursor position
updates the correct cursor at roomId to the new position 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 } color the cursor color @param { line : number ch : number } cursor the cursor position