# node libraries
path = (require 'path')
logger = (require 'logging').default 'socket'
# my libraries
module.exports = (socket) ->
logger.info 'Client connected.'
socket.on 'message', (msg) ->
# echo server
logger.info "Echo '#{msg}'."
socket.send "Re: #{msg}"
socket.on 'close', ->
logger.info 'Client disconnected.'
# 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