src_backend/socket.js
/**
 * sets up the socket connections for the http server
 * @param {Server} server server connection
 */
sets up the socket connections for the http server
@param {Server} server server connection
sets up the socket connections for the http server @param { Server } server server connection
function socketSetup (server) {
  const io = socketIO(server)
  io.on('connection', socket => {
    counter.inc()
    socket.on('disconnect', () => counter.dec())
    socket.on('join room', data => joinRoomHandler(io, socket, data.room))
    socket.on('leave room', data => socket.leave(data.room))
    socket.on('send code', data =>
      broadcastCodeHandler(socket, data.room, data.newCode)
    )
    socket.on('send cursor', data => 
      broadcastCursorHandler(socket, data.room, data.color, data.cursor)
    )
    socket.on('remove cursor', data => 
      broadcastRemoveCursorHandler(socket, data.room, data.color)
    )
  })
}
function socketSetup ( server ) { const io = socketIO ( server ) io . on ( 'connection' , socket => { counter . inc ( ) socket . on ( 'disconnect' , ( ) => counter . dec ( ) ) socket . on ( 'join room' , data => joinRoomHandler ( io , socket , data . room ) ) socket . on ( 'leave room' , data => socket . leave ( data . room ) ) socket . on ( 'send code' , data => broadcastCodeHandler ( socket , data . room , data . newCode ) ) socket . on ( 'send cursor' , data => broadcastCursorHandler ( socket , data . room , data . color , data . cursor ) ) socket . on ( 'remove cursor' , data => broadcastRemoveCursorHandler ( socket , data . room , data . color ) ) } ) }
sets up the socket connections for the http server
 @param {Server} server server connection
sets up the socket connections for the http server @param { Server } server server connection