Created
September 18, 2015 05:30
-
-
Save LordZardeck/1aa1875960e068251528 to your computer and use it in GitHub Desktop.
Developing against Socket.io server
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
# Developing against Socket.io server | |
To simulate a socket.io server, open node in REPL and paste these lines: | |
```js | |
var app = require('express')(), http = require('http').Server(app), io = require('socket.io')(http); | |
io.on('connection', function(socket){ console.log('a user connected'); }); | |
http.listen(3000, function(){ console.log('listening on *:3000'); }); | |
``` | |
Now you can emit events in REPL like so: | |
```js | |
io.emit('zone-accept', 'player-one-table'); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment