We are currently having a problem with our meteor app.
Because of the problems with ios we changed for our Meteor app the DISABLE_WEBSOCKETS to 1. But then we had problems with our nginx so we changed it back to 0 (in our case we just removed the ENV variable from our deployment)
Since them Meteor is still not using Websockets. We have no idea why. This causes the problem that we get this error:
POST https://OUR_APP.COM/sockjs/632/bl2mtg76/xhr_send 404 ()
Uncaught Error: INVALID_STATE_ERR
So Meteor is using sockjs instead of websockets.
We have tested the env variable if its set correctly.
console.log(process.env.DISABLE_WEBSOCKETS); // logs 0
For deployment we are using pm2-meteor.
Does anyone has an idea why Meteor is forced to use sockjs instead of websockets ? We have now deployed our app several times but it does not change smth.
Btw: Websockets are - of course - enabled in my browser.
Related
I have a Laravel + Vuejs project and while everything works fine on local development, 2 pages are throwing the ChunkLoadError.
I have looked at other issues on SO, and checked my output path, file is really there.
Page is here : https://dev.trouveruncouvreur.ca/guide-toiture and same for https://dev.trouveruncouvreur.ca/city/d-soumission-couvreur-toiture-Brossard
Error is here :
The chunk is available if you click on the link https://dev.trouveruncouvreur.ca/js/blogs-component.js
Edit: I deleted the project from the dev server, and reinstalled everything without success. I keep having the same issue. I did install on another server I have access to, and the error is gone, pages are all served correctly. We just found out client on dev server is using Cloudflare, so once we have acces, we can delete cache and see how it goes.
In this case, Cloudflare's cache was the culprid. All vues files/chunk are now correctly served.
I have two applications - browser based client and NodeJS based server that are both communicating using WebSockets (I'm using ColyseusJS library). Problem is, that everything works fine while I'm testing them on localhost but when I deploy the application to my Ubuntu VPS server it stops working.
The message I receive in the browser while trying to connect is:
WebSocket connection to 'ws://X.X.X.X:8001/?colyseusid=' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
So it reaches the server (because when server is disabled the message is "Error in connection establishment: net::ERR_CONNECTION_REFUSED") but it looks like it fails on Upgrade connection operation.
What is strange is that I managed to make it work yesterday (don't know how exactly), but had so much mess on my VPS that I decided to revert machine to it's starting state. After that it stopped working (code is unchanged). Maybe there are some additional dependencies that I need to install in order to make it work on my Ubuntu Server?
I would really appreciate your help.
Have you tried to port forward the port to the ip address of the said VPS in your router config? And also check out the firewalls.
I have a slight problem with use of Node.js and socket.io on Heroku. It works fine locally but as soon as I push it to Heroku and go on the website it gives me the application error page. Looking at the logs there is no explicit error but I have a feeling what it might be. When I run it locally, I use sudo node server to start the app. Just node server gives the same effect as that on heroku.
So basically, my question is: How do I get Heroku to run in sudo mode, or how can I remove the need to use sudo altogether?
Apologies as this is my first time using socket.io, so I am a bit unfamiliar with the workings of the library.
P.S. I am using Express 3.
I would check into the port you are using. On a normal ubuntu machine for example you may have to use sudo for low numbered ports (such as port 80). Besides that Heroku has a lot of load balancing going on, so the port you will use to connect to the service may not be the same as the port you tell the instance to listen on.
I would try using port 5000 as per this example from Heroku
Nodejs with sockets
I have this web app written with express and socket.io using node.js, the app works brillantly on localhost, but when i push to my ec2 server, it connects for like 20 seconds then disconnects, and then connects again etc...
giving me the error on the node console as
warn - websocket connection invalid
info - transport end
SERVER
app = express()
server = http.createServer(app)
io = require('socket.io').listen(server)
CLIENT
socket = io.connect()
I know the problem is not with my code, because I fully tested the web app on localhost, so the only problem is where this code is running, which is my ec2 instance?
There could be many possible reasons you can get this error:
You are using browser that partially or does not support websockets. You can check if your browser supports websockets here.
Using proxy that does not support websocket. If there is some server(load balancer) between your client and your node server that does not support websocket.
You are using socket.io version 0.9.1/0.9.1-1. This behaviour is a reported bug for this version. So upgrade to latest socket.io version which is 0.9.14.
Browser connectivity is firewalled/blocked.
Code related problem.
Make sure you're using latest versions of node, express and socket.io on your ec2. Also, provide some data about currently used versions both on your local machine and on ec2 instance.
Running on your local machine you don't have to deal with network latency, NAT issues, or firewalls. Running on EC2 you have all of those.
Web Sockets are relatively new and unstable. So to begin with be sure you're running the latest versions (and let us know what they are). Perhaps the version of socket.io installed on your local machine is different than the version installed in your EC2 server.
If there is no activity during those 20 seconds before losing the connection, one possibility is that keep-alive is set too low.
See https://groups.google.com/forum/?fromgroups=#!topic/socket_io/RUv70BguZ-U for a similar problem. The solution there was to use heartbeat to keep the connection open.
A bit more on socket.io heartbeats if you're not already using them:
Advantage/disadvantage of using socketio heartbeats
I am creating a Node.js app on Heroku and have run into an issue. I am trying to use Hook.io in my application but am getting a "Bad Bind" error from Heroku because Hook uses port 5000. Does anyone know of a way around this, maybe by somehow telling Heroku I need another port for Hook?
What you describe requires hook.io have access to bind to multiple TCP ports. I'm not sure how much success you will find on Heroku with this.
You'll also note that hook.io-webserver has been deprecated see: https://github.com/hookio/webserver in favor of the latest core hook.io API which allows for native HTTP and Websocket support for hooks.
For new HTTP webserver API, see: https://github.com/hookio/hook.io/blob/master/examples/webserver/server.js
Hook.io is defaulting to port 5000, but on Heroku, you need to use the port Heroku dynamically assigns your app.
var hook = hookio.createHook({
hook-port: process.env.PORT || 5000
});
Here are the configs available for Hook.io.