Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add socket io example to homepage #22

Open
frank-dspeed opened this issue Aug 1, 2015 · 0 comments
Open

Add socket io example to homepage #22

frank-dspeed opened this issue Aug 1, 2015 · 0 comments

Comments

@frank-dspeed
Copy link
Contributor

frank-dspeed commented Aug 1, 2015

// Diet Server
var server = require('diet')
var app = server()
app.listen(8000)

// Socket.io
var io = require('socket.io')(app.server) // <-- use app.server 

// Listen on websocket connection
io.on('connection', function(socket){
  console.log('a user connected');
});

// Now you can access socket.io from client side with:
// http://localhost:8000/socket.io/socket.io.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants