This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/backend/socket.coffee

43 lines
977 B
CoffeeScript
Raw Permalink Normal View History

2019-02-07 16:03:20 +00:00
# node libraries
path = (require 'path')
logger = (require 'logging').default 'socket'
# my libraries
module.exports = (socket) ->
2019-02-19 20:48:25 +00:00
logger.info 'OK connect'
socket.on 'message', (msg) ->
# echo server
2019-02-19 20:48:25 +00:00
logger.info "OK received '#{msg}'"
socket.send "Re: #{msg}"
socket.on 'close', ->
2019-02-19 20:48:25 +00:00
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