Currently I am developing a mobile application with ionic 2. Within the application I got chat functionality. The chat functionality is based on Socket io in a NodeJS API. Unfortunality, it is hard to configure the socket io on Google Cloud App Engine. On my local machine it works fine.
Steps I have undertook:
use port 65080 (and open the firewall port)
2 servers (api calls via 8080 and socket io via 65080
Sample
Does anybody have a solution? Thank you in advance!
Jelle
Sadly, neither socket.io or Websockets currently work on App Engine. This is something we're actively trying to address:
https://cloud.google.com/appengine/docs/flexible/nodejs/how-requests-are-handled#not_supported
This question is almost identical to this one, and there's some new good news:
GAE support for persistent socket connections arrived in February 2019!
To make this work, you'll need to be using the flex environment and modify your app.yaml to include session_affinity.
Related
I'm currently working on a game that connects to a Node.js server for multiplayer data.
The game is developed in Unreal Engine 4 and uses the Socket.io plugin to connect to the Node.js server (cors, express being used).
Everything works locally. So now I'm trying to move on to hosting the server remotely and connecting the unreal client to the remote Node.js server.
I looked into Heroku and set myself up, everything is working fine on its end to my knowledge - I created a tester page with a success message when you load the URL and that comes through.
My first question is - what am I doing wrong when I use unreal to point the socket.io plugin to the server url?
The socket.io plugin asks for a port #, I've tried the following:
http:/{my server/heroku url}:8080/
http:/{my server/heroku url}:3000/
http:/{my server/heroku url}:18279/ (which was given to me by Heroku).
http:/{my server/heroku url}/
So far the game does not connect to the deployed server, the way it does locally.
Any suggestions on what could be going wrong/what am I failing to do next?
A few things after researching:
I do have http-session-affinity enabled
Since the server is working locally, I'm going to make the assumption that the deployed code is not the issue, and that it has to do with the way I'm trying to connect.
is it possible that I have further authorization to config? Such as allowing the unreal game/client to connect to the server/that the client is being blocked some how?
I figured out the issue, it had to do with how my Node.js server code was calling socket.io.
If you come across this issue please send me a message or comment here and I will be happy to send you the code that worked.
I have a websocket server running via NodeJS, and have deployed it to Heroku. There are two separate web applications I wrote that communicate with the websocket server. On localhost, I simply run the node server, load up the applications in a web browser, and all works fine. In Heroku, however, I can't seem to get anything to connect to the url ws://url:port - it just returns an err request timeout.
I don't want to deploy my html using Express per their example. Maybe I could, but this is a test case where some web applications get to be pretty huge.
Is my issue that I have to use wss instead of ws?
Or backing up further, is this a good use case for Heroku or is there something else I should use?
The easiest description of what I'm trying to do: Two websites hosted somewhere that isn't Heroku both communicating with a NodeJS-based websocket server hosted on Heroku.
Thanks for your help!
Alright, I feel pretty dumb because this is about as easy an answer as it gets. For anyone else trying to do the same thing, you don't need to specify the port (Heroku port is for internal use only, and the heroku url you are provided is on port 80). Simply connect using wss (e.g. wss://your-app.herokuapp.com)
I'm trying to develop a web application in nodejs. I'm using an npm package called "simple-peer" but i don't think this issue is related to that. I was able to use this package and get it working when integrating it with a laravel application using an apache server as the back end. I could access the host machine through it's IP:PORT on the network and connect a separate client to the host successfully with a peer-to-peer connection. However, I'm now trying to develop this specifically in node without an apache back end. I have my express server up and running on port 3000, I can access the index page from a remote client on the same network through IP:3000. But when I try to connect through webrtc, I get a "Connection failed" error. If I connect two different browser instances on the same localhost device, the connection succeeds.
For reference: i'm just using the copy/pasted code from this usage demo. I have the "simplepeer.min.js" included and referenced in the correct directory.
So my main questions are: is there a setting or some webRTC protocol that could be blocking the remote clients from connecting? What would I need to change to meet this requirement? Why would it work in a laravel/webpack app with apache and not with express?
If your remote clients can not get icecandidates, you need TURN server.
When WebRTC Peer behind NAT, firewall or using Cellular Network(like smartphone), P2P Connection will fail.
At that time, for fallback, TURN server will work as a relay server.
I recommend coTURN.
Here is an simple implementation of simple-peer with nodejs backend for multi-user video/audio chat. You can find the client code in /public/js/main.js. Github Project and the Demo.
And just like #JinhoJang said. You do need a turn server to pass the information. Here is a list of public stun/turn servers.
Title is fairly self explanatory. I need to create an XMPP server in Node.js to communicate with Google Cloud Messaging. The XMPP connection should allow me to send messages from the server to the client (Android app) and also from the app back to the server without the app needing a seperate socket connection to the server (all messages routed through GCM. Could anyone perhaps guide me in the right direction?
P.S. If I have provided insufficient information please let me know :)
It seems that a simple Google search return that there is an XMPP server developed in NodeJS: https://github.com/node-xmpp/node-xmpp-server
This is likely what you want to deploy.
I'm trying to push a node.js app to heroku.
The app has a http server listening on one port (process.env.PORT) but I also want a web socket using another port. Is this possible in heroku? I am using ws.js to do the sockets.
On my local machine I can obviously use 3000 for one port and 8080 for the other, but I can't see how to define a second port that heroku will be happy to let me use.
thanks
matt
According to Heroku they don't yet support WebSockets: see this article. According to this SO question you can use socket.io (< v0.7) to do realtime stuff, but you can't use WebSockets, it'll fall back to XHR polling.
Heroku now supports websockets, as of 2013. For implementation have a look at the following article:
https://devcenter.heroku.com/articles/node-websockets