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/server/scripts/10-socket.coffee

40 lines
750 B
CoffeeScript
Raw Normal View History

2018-10-03 22:07:17 +00:00
# libraries
http = require 'http'
socketio = require 'socket.io'
express = require 'express'
gulp = global.gulp = require 'gulp'
helmet = require 'helmet'
# gulp the sources
require './gulpfile'
gulp.start 'default'
# socket.io framework
app = express()
web = http.Server app
io = socketio web
# Listen server
web.listen 8080, ->
console.log 'Node.js listening on port 8080'
app.use helmet()
# Static content
app.use ( express.static __dirname + '/../static' )
# Server logic
io.on 'connection', (socket) ->
console.log 'a user connected'
console.log socket.id
socket.on 'disconnect', ->
# console.log 'user disconnected'
return
socket.on 'login', ->
console.log 'message:', msg.uname, msg.password
return
return