You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
The text was updated successfully, but these errors were encountered: