Last active
October 17, 2016 15:14
-
-
Save rjriel/b3dafc611bb8ef0796ccdcb2a135de2b to your computer and use it in GitHub Desktop.
Source for trying to illustrate socket.io issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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