0

The Heroku Dev Center article Using WebSockets on Heroku with Node.js explains how to deploy the Node.js Websocket Test demo application, which uses Express.

However, I'm deploying a Node.js WebSocket chat server that doesn't use Express.

When I try to connect from Terminal with wscat -c ws://my-app.herokuapp.com/1, I get error: Error: unexpected server response (503). And, heroku logs returns code=H14 desc="No web processes running".

Why? How do I fix this?

Note: My Procfile is correct: web: node server.js.

Community
  • 1
  • 1
ma11hew28
  • 121,420
  • 116
  • 450
  • 651

2 Answers2

1

Solution: Delete & recreate the app.

I changed the first line of the Node.js WebSocket chat server to:

var webSocketServer = new (require('ws')).Server({
      server: require('http').createServer(function (request, response) {
        response.end()
      }).listen(process.env.PORT || 5000)
    }),

Still didn't work.

Then, I deleted & recreated the Heroku app and deployed. Worked.

Then, I changed the first line back to:

var webSocketServer = new (require('ws')).Server({port: (process.env.PORT || 5000)}),

and redeployed. Still works!

Community
  • 1
  • 1
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
0

Can you connect with curl -vD to get verbose information on what headers you server is sending?

Dan Kohn
  • 33,811
  • 9
  • 84
  • 100