Getting 503 using websockets on heroku, Custom Domain - node.js

I'm trying to establish a websocket connection on my heroku node server but keep getting the following error:
browser.js:13 WebSocket connection to 'ws://www.mywebsite.com/' failed: Error during WebSocket handshake: Unexpected response code: 503
Works great locally, but when I deploy it to heroku, it's a no go.
I'm running a custom domain in front of my heroku instance and I'm wondering if the dns or something might be causing issues.
Anyone experience something similar?

Related

502 Exception - Azure Virtual Machine

I have azure virtual machine, hosted angular application which is having NodeJs as a backend.
Sometimes it is throwing 502 exception.
If we refresh the page and try to hit the api then we get response. But, sometimes it throws 502 and tells nothing other than this. We tried capturing IIS logs, there also no info about this exception.
Please help me to resolve this issue.
It is Server Side Problem. Kindly check the proxy or ip you're hitting. 502 Bad Gateway Error, which indicates that a server somewhere within the server stack — specifically, one which is acting as a gateway or proxy itself — received an invalid response from a different server.

Error during WebSocket handshake on AWS instance

I created a new instance on AWS (Ubuntu) and setted up the app correctly. Everything is fine except socket.io cannot connect using websockets and that kind of creates a lot of lag on mobile phones.
I get this error:
WebSocket connection to <url>' failed: Error during WebSocket handshake: Unexpected response code: 400
This happens only on my EC2 instance. I'm not using any elastic beanstack. Plain simple AWS instance running expressjs server listening on port 80. I read somewhere that nginx is required to be configured. But all I did was fired node server so there is no /etc/nginx directory on the ubuntu instance.
I've been trying to figure this out from very long time. Please help.

Real-time Gaming with Node.js + WebSocket in Google Cloud Platform tutorial?

I'm a front-end developer that want to use websocket+node.js for a game in the browser.
What I'm asking for is a great tutorial on how to get that working in the Google Cloud or any other help for that matter.
What I found is this:
https://cloud.google.com/solutions/real-time-gaming-with-node-js-websocket
But I'm not that familiar with the server end and is all new to the Google platform so it doesn't help me a lot.
I have a simple socket example working as long as it's in my local environment but when I deploy it I get lot's of strange errors in the console.
You can find it here
http://socket-1281.appspot.com/
There error in the console log says:
WebSocket connection to 'ws://socket-1281.appspot.com/socket.io/?EIO=3&transport=websocket&sid=BXTZAZbQVQYA1TBLAAAA' failed: Error during WebSocket handshake: Unexpected response code: 400
Failed to load resource: the server responded with a status of 400 (Bad Request)
So does anyone know how to solve this or where to find help?
Here's the source
https://app.box.com/s/a3ma8ivel1qj378m9nh7s9q1e3xreo7n
The loadbalancer of Google App Engine doesn't support websockets. If you try to connect to socket-1281.appspot.com it will go through the loadbalancer and won't work. What you need to do is to avoid the load balancer by directly connecting to your instance.
Here is an example that might help:
https://github.com/thebergamo/appengine-websocket-nodejs#how-to-setup-the-deployment-environment

Websocket not working with socket.io in heroku

My app is working fine in localhost with socket.io using websockets and xhr-polling and it's working with xhr-polling in heroku, but since heroku provided support for websocket I can´t make it work using websockets.
My Chrome console shows this message:
WebSocket connection to 'ws://<myherokuapp>.herokuapp.com/socket.io/1/websocket/HBWE2BFvHahlSWk5ppHP' failed: Unexpected response code: 503
I already enabled websocket labs.
Is there any working example of websocket using socket.io?
I had the same problem and just fixed it by reactivating the websockets on my app on heroku.
It had just randomly switched over to XHR polling for some reason.
I used this command from heroku's site (# https://devcenter.heroku.com/articles/heroku-labs-websockets) to reactivate it:
heroku labs:enable websockets -a myapp
I then restarted my server by pushing to heroku and having it rebuild (or using: heroku restart).
I also have a working copy of a very basic socket.io chat application (written by Smitha Milli) running at: http://calm-gorge-8474.herokuapp.com/ that you can test.
Hope this helps!

Browser, behind Squid, can't establish connection to socket.io websockets transport

My problem is simple to explain but not so simple to fix I think since I haven't found a solution yet.
I'm developing an API. The backend is developed using NodeJs and Socket.Io. Everything works perfect but the issue arises when I'm on a net that's behind a firewall, Squid in this case. It is the browser who is behind the firewall not the server (NodeJs).
The thing is that I get this error:
WebSocket connection to 'ws://mydomain.com/socket.io/1/websocket/vN8hWt_EjV0Z5P5-GwrW' failed: Unexpected response code: 502 (socket.io.js:2)
and I don't know how to the browser can skip Squid.

Resources