# node libraries socketio = (require 'socket.io') path = (require 'path') logger = (require 'logging').default 'socket' # my libraries FFTCGSOCKET = (http, session) -> that = @ # create server socket @io = socketio http @io.use session # on new connection @io.on 'connection', (socket) -> @session = socket.handshake.session logger.debug "session '#{@session.id}' connected" logger.debug "is user '#{@session.userID}'" if @session.userID socket.on 'disconnect', -> logger.debug "session '#{that.session.id}' disconnected" logger.debug "is user '#{that.session.userID}'" if that.session.userID return FFTCGSOCKET::close = -> logger.info 'shutting down' module.exports = FFTCGSOCKET