Apollo monorepo - WS connection - heroku

I'm working on an Apollo Graphql real time app which is deployed to Heroku and contains both client and server files in the same project (the server is serving the create-react-app build files).
I'm trying to open a websocket connection between the client and the server and I can't figure out how to do so.
I tried to set the ws uri in the client to "wss://" but apollo returns an error which is saying that it's not a valid uri.
Previously I had two different projects (client / server) on heroku and I set in the uri the path to the server app and it's worked properly.
Thanks very much in advance for any help.

Related

Could the server and app run in the same domain?

The situation I met is that.
I design a frontend app by React, but I want to connect to MongoDB.
From what I knew so far, I could only connect to MongoDB in the backend. So, I use the express to set up a server but when I try to connect the frontend to the backend, the answer I found seems to tell me that I should run the server and the app on different domains, so I should run the server and app on different Heroku apps.
Could I put the server and app in just one Heroku app and connect between them?

Unable to connect to Websocket from CloudRun

We have a backend developed with Golang using Fiber (gofiber) and used also Fiber's Websocket middleware.
When trying to connect from a Web client in local (ws://...) it works perfectly. When deploying our server to CloudRun, and trying to connect (ws://...) it returns a 400.
Any idea what I am missing?
WebSockets are currently not supported on Cloud Run fully managed. This is a highly requested feature, but it's not yet implemented.
However, running WebSockets currently works on Cloud Run for Anthos because of its GCE-based native networking layer.

How to connect From Web Server to Database Server via App Server

I developed a web application in spring boot which can deployed from a webserver in tomcat and connects to database server directly.But now I have to switch to a another database which is not accessible from the webserver.So I was advised to follow the pattern
Web Server -> App Server -> Database Server
But I am not sure How to convert my web app into this format.Becuse current my format is
Web Server -> Database Server
Could anyone explain how to implement this.Any help is appreciated?
You have some misunderstanding with Web Server and Application Server. Read more at What is the difference between application server and web server?
The communication structure would be something like
Edge Server -> Internal Server -> Database
Now, your problem can be resolved by moving your current api to internal server which can directly connect to DB and create a pseudo api in Edge Server which just calls the api from Internal Server and sends response back to the client.
Pseudo API -> Actual API -> Database

Web API 2 call from Proxy Server

I have java scripts web application calling my ASP.NET web API 2 Service under same web site in my AppServer. The application is working fine.
I setup Proxy Server and URL Rewrite to my Application Server. Everything is working fine with Http but can't call web api from JavaScript with Https
I put CROS and add the Proxy Server but still doesn't work.
But I can directly call web api with https
Kindly Advice!
Regards,
Si Thu
Finally, I found out that it is because of Mixed Content Issue between proxy server and application server. App Server also need to be HTTPS
Issue is solved by adding certificate in App Server.

How to make XSockets.WebSocket work on HTTPS?

First I'd like to apologize if this question has already been answered on other posts.
I'm pretty new in WebSockets and WebRTC and here's my scenario.
I created an MVC4 application in VS 2012 and install the a sample WebRTC project via nuget package manager console (followed the steps here: http://xsockets.net/blog/tutorial-building-a-multivideo-chat-with-webrtc).
This seems to work fine on my local machine. I deployed the code on our https server (running on IIS6) and I changed the connection string to handle the https connection (code below:)
peerBroker = new XSockets.WebSocket("wss://mydomain.com:443/CustomBroker");
I then hit the URL and I got an error that says:
WebSocket connection to 'wss://mydomain.com/CustomBroker' failed: Error during WebSocket handshake: Unexpected response code: 401
Does anyone have an idea as to what I'm missing here?
You cant just change the connectionstring to be wss.
Have you configured XSockets to run over wss?
See XSockets Configuration

Resources