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.

2 Answers 2

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!

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.