# node libraries
path = (require 'path')
logger = (require 'logging').default 'socket'

# my libraries

module.exports = (socket) ->
  logger.info 'OK connect'

  socket.on 'message', (msg) ->
    # echo server
    logger.info "OK received '#{msg}'"
    socket.send "Re: #{msg}"

  socket.on 'close', ->
    logger.info 'OK disconnect'

# 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
