Skip to content

Instantly share code, notes, and snippets.

@rjriel
Last active October 17, 2016 15:14
Show Gist options
  • Save rjriel/b3dafc611bb8ef0796ccdcb2a135de2b to your computer and use it in GitHub Desktop.
Save rjriel/b3dafc611bb8ef0796ccdcb2a135de2b to your computer and use it in GitHub Desktop.
Source for trying to illustrate socket.io issue
const io = require('socket.io-client')
let socket = io.connect('http://localhost:3000')
socket.on('connect', (data) => {
let playerId
console.log('connected')
socket.on('success', () => {
console.log('logged in')
})
})
const server = require('http').createServer()
const socketio = require('socket.io')
io = socketio.listen(server)
// need to initialize Game below because
// socket io is required in the game model
io.on("connection", (socket) => {
console.log("connected")
socket.emit("success")
})
server.listen(3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment