Skip to content

Instantly share code, notes, and snippets.

@LordZardeck
Created September 18, 2015 05:30
Show Gist options
  • Save LordZardeck/1aa1875960e068251528 to your computer and use it in GitHub Desktop.
Save LordZardeck/1aa1875960e068251528 to your computer and use it in GitHub Desktop.
Developing against Socket.io server
# 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