Websockets with NextJS in Heroku - heroku

Is it possible to use websockets with NextJS in Heroku?
I have a web app deployed in Vercel. Vercel does not support websockets. They recommend to use a third-party service. The problem is that this service doesn't work properly. I've implemented it already without getting the desired result. Doing some research I found out that the nature of Vercel makes it difficult to implement websockets.
Some people recommend to use Heroku. Heroku supports websockets. But it's not clear to me if I deploy my NextJS project on Heroku I'll be able to implement websockets out of the box. Or do I have to port my project to a different technology like ExpressJS.

Related

Can we use websockets protocal in the Google Cloud run? (Not the current socket.io)

Currently, GCloud run support socket.io for bi-directional comunication. But I am looking for websockets protocal. How can we use websockets communication in the GCloud run?
I did deploy my backend app (node.js) in the Gcloud run and found that it support only socket.io, not websockets implementation.

Should I use api gateway for web application with embedded UI?

I have some applications which have UI embedded in Django or ROR app. These applications do not have api but a monolithic web application which have UI and backend in a single module.
All the example I have seen talk about using api gateway for http api. Does it add any value to put such Django or ROR app behind an api gateway?
I am using Kong as api gateway. Not sure if Kong even works with such app. The documentation in Kong only talks about configuring services which are pure api.
If I do not put these applications behind api gateway, then I end up creating a mixed approach where some applications are behind api gateway and some are not. I definitely want to avoid this situation. This makes the whole configuration complex.
Any suggestions will be helpful.
There is nothing wrong with monolithic applications behind a gateway and seems to be a recommended way.
You would benefit from Kong, as it provides different plugins, like Traffic Control or IP Restriction. Also you would have your configurations in a single place. So there are no reasons not to use gateway.
I do not know how your applications are exposed now, but when you will put them behind kong (or proxy) one thing you probably have to look at is client’s request IP: https://discuss.konghq.com/t/how-to-forward-clients-request-ip/384

Uploading Angular 2 app to web hosting

So far I've used web hosting such as https://uk.godaddy.com/hosting/web-hosting for my websites, but seem like running angular 2 app has different way for publication.
So, since I found nothing about running Angular 2 app to be available public, and not only in localhost
My questions are -
What providers do allow such apps to be hosted on them? now I'm using npm start in my project folder to run my app, does it works the same way?
Since my backend is Laravel and supposed to be in the same domain as the Angular2 frontend, These providers allow to host the API's too?
Thanks in advance!
I have also hosted my laravel backend and angular front end using openshift. In terms to your application, I recommend you the following two providers.
Amazon Web Service. You can get 1 year free trial, EC2 is really wonderful to host whatever you want. In EC2, you can configure the environment for angular 2 and laravel by yourself. You can run any command including npm install in EC2
Openshift. You can freely create 3 gears to host your application. The environment is very easy to configure. If you want
to deploy angular 2, laravel applications, there are specific gears for these frameworks, so openshift
should be the best choice.
The answer to your second question : Yes, they allow to host the APIs !

where to deploy a web2py app that uses websockets?

I asked this question and it seems pythonanywhere doesn't support websockets.
pythonanywhere - How do I use websockets to transmit messages as per the web2py messaging example?
so the question is where could I deploy the app as effortlessly as possible?
right now when I run it locally its as easy as
python web2py.py &
python websocket_messaging.py -p 8888 -k mykey
It's not going to be as easy as pythonanywhere, but you could deploy to any VPS, such as Digital Ocean. To make things easier, use one of the web2py deployment scripts, such as https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh. Once you have the basic server set up, you'll still need to install Tornado and follow the other instructions for using websocket_messaging.py.

Can I have multiple heroku subdomains for my app?

Say you have two apps hosted on heroku: appA and appB. They will be accessible at appA.herokuapp.com and appB.herokuapp.com. Is there a way to "share" the subdomains? As in, can I have appA listening on both urls?
I suppose I could have appB forward all its traffic to appA, but I'm more curious if it can be done through some heroku setting.
Thanks!
No, this cannot be done through a heroku setting. You either need one of the two apps acting as a reverse proxy to the other app, or else you need a third server running a dedicated reverse proxy such as nginx.
Heroku support once suggested using a third heroku app as an nginx reverse proxy with a custom buildpack to accomplish this, although I decided not to go that route. It is unfortunate that there is no systematic support for multiple apps on the same domain at Heroku, but that would add significant complexity to their currently predictable and transparent routing platform (which is itself a non-configurable reverse proxy).

Resources