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

Documentation does not appear to be updated for Express 4.2 #104

Open
jrgleason opened this issue Aug 29, 2014 · 3 comments
Open

Documentation does not appear to be updated for Express 4.2 #104

jrgleason opened this issue Aug 29, 2014 · 3 comments

Comments

@jrgleason
Copy link

I am trying to figure out how to broadcast from an existing web application. The new version of a generated express application looks as follows...

app.js

app.get('/route', function(req, res){
  req.io.broadcast('new visitor');
});

No dice this gives me a 404 so I try to move things into the routes\index.route file...

var express = require('express');
var router = express.Router();
...
router.get('/route', function(req, res){
  req.io.broadcast('new visitor');
});

Still no dice this gives me an undefined exception. So what is the proper way for setting this up in Express 4? Currently does work in the app.js...

app.http().io();
app.io.route('ready', function(req) {
    req.io.emit('talk', {
        message: 'io event from an io route on the server'
    })
})
@pretentiousgit
Copy link

+1 - this looks super useful, but def need Express 4+ support.

@mike-feldmeier
Copy link

+1 - agreed. I've seen in other issue comments that techpines is working on Express 4 support as recently as July. Looking forward to that!

@dmyers
Copy link

dmyers commented Jun 15, 2015

Yeah broadcast() wasn't working for me either, had to use emit(). Was it just renamed? The last time the broadcast example was modified was in 2012.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants