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

express-ws route does not work on heroku #97

Open
pivcec opened this issue Jun 10, 2018 · 2 comments
Open

express-ws route does not work on heroku #97

pivcec opened this issue Jun 10, 2018 · 2 comments

Comments

@pivcec
Copy link

pivcec commented Jun 10, 2018

When I browse to the following websocket enabled route on localhost, then it works fine ("hello from player route" is returned). I am also able to sent messages to it via websockets. When I deploy this app to Heroku, then I am able to browse to this route ok, but when I try to connect via websocket (through debugger tool), then it never connects, and I get a server error.

app.js:

const express = require('express'); let expressWs = require('express-ws'); expressWs = expressWs(express()); const app = expressWs.app; const router = express.Router(); ... const playerRouter = require('./routes/player')(router); ... module.exports = app;

player.js:

`module.exports = (router, db) => {
router.get('/api/player/:id', (req, res, next) => {
res.send('hello from player route');
res.end();
});

router.ws('/api/player/:id', (ws, req) => {
ws.on('message', msg => {
console.log('msg', msg);
});
});
}`

Error on server:

heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/api/player/1" host=shielded-river-25076.herokuapp.com request_id=1ea0d954-7b06-4f46-b86f-6016cb910be4 fwd="2.229.13.61" dyno=web.1 connect=0ms service=1ms status=503 bytes=0 protocol=http

@ApolloRoad
Copy link

dont't use this ! express-ws is shit!

@bato3
Copy link

bato3 commented Jul 6, 2018

@pivcec This module has problems when you use identical routes for get and ws. Try find more in: #64 and #68

Or I'm wrong...

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

3 participants