Socket.io with YARP - socket.io

I am trying to build a system using Socket.io and YARP. Yarp is functioning has a Reverse Proxy to all my Services.
When trying establish a connection to my socket.io service, through yarp, I am getting connection_error:
I noticed there are proper configurations used in other Reversed Proxy solutions that are well documented in Socket.io website:
https://socket.io/docs/v4/reverse-proxy/
However, I can't "translate" what they are doing to YARP. Does anyone know if this is possible?
Thanks in advance

I guess stackoverflow was my rubberduck this time...
I checked in postman the request that was being made through my Yarp Server and turns out it wasn't even hitting the correct path. For yarp to connect to a socket.io server you have to use this kind of path in your configuration file:
It seems that a sokcetio request uses it's own path, so you have to make your reverse proxy match the beggining "socket.io/"

Related

YARP simple direct forwarding configuration

I have a web api application built with yarp support listening on port 443.
I know it is up and running because postman says so when https://myserver/info. 'Info' is a simple http GET returning some strings from a simple controller.
I also have a web api project listening on port 5002 which I know is functioning because postman says so when https://myserver:5002/myotherapp/info.
I would like postman to tell me that https://myserver/myotherapp/info is also valid, but have not been able to configure it so.
I have tried numerous different combinations in the appsettings.json to achieve this but to no avail. All I am trying to do is direct to localhost:5002 on the server. In my current setup I am seeing 503 Service Unavailable in postman.
It may not be a configuration issue but could someone assist me by confirming what the ReverseProxy element of appsettings.json should look like in this simplest of cases?

Firefox can’t establish a connection to the server at wss://127.0.0.1

i'm trying to create a realtime app with laravel-websockets package, i followed the steps in laravel documents and also the laravel-websockets package and i did all the thing exact the same as docs, but whenever i try to send an event through the channel i receive this error in the browser console:
Firefox can’t establish a connection to the server at wss://127.0.0.1/app/myKey?protocol=7&client=js&version=6.0.3&flash=false.
does any body know how can i solve this error?
i found a solution for my case here:
https://github.com/beyondcode/laravel-websockets/issues/382#issuecomment-631569344
try this out, i hope it works for you too.
I think this is an SSL related problem. Here you are using wss:// protocol on the localhost. I would suggest you use ws:// protocol instead of wss://.
Hope that this will work.

Gravitee.io websocket connection

I set up an API Gateway through Gravitee.io and a Springboot application, and everything seems to work fine as per the rest endpoints, running in https also.
Now, I would like to open a websocket connection through the same port (8080), but when the client tries to do it, this error come up server-side:
Handshake failed due to invalid Upgrade header: null
Looking for some solutions online, seems like a port issue, which could be potentially easy to manage with a tomcat server. But there is a way to address this issue using Gravitee.io ?
Thanks
I would advice you to create an issue in gravitee.io repository at https://github.com/gravitee-io/issues/issues/new
Websocket is not yet ready within Gravitee.io

Neo4j HTTPS only?

there doesn't seem to exist any configuration that enables HTTPS only access to neo4j databases.
I've tried disabling the HTTP connectors but neo4j needs at least one HTTP connector otherwise it wouldn't start the service at all.
I found that commenting out the HTTP connector would let the neo4j service start but triggers an error in all browsers except chrome that wouldn't let you connect to the database.
As far as my research has brought me. There is no neo4j-only solution to this problem at the moment.
From what I've read and found out there might be several possibilities like limiting http access to port 7474 from outside of your network and redirecting http to https.
I was not able to test them personally but it seems that there's no different way to do this.
For now http has to be enabled and configured for https to work.

Making request using WebSockets in sails but not receiving response from the server

I'm starting with Websockets and I have a problem.
I have a sails.js application that uses sockets to update the client side.
On the client side it makes an API call using socket.get("/api/v1/actor...") to bring all the items of the database. When I see what the WebSocket's traffic on the Chrome console:
As you can see, the connection has been established and the API call has been correctly done through the socket.
The problem is, there is no answer from the server, not even an error.
If I make the same API call using ajax, I get response, but it doesn't work using WebSockets.
Any idea what might be producing this behavior?
EDIT: I add here the code here that processes the request and this one here that sends the request, but the problem is that it never execute this code. I think we we are closer to the find the cause, since we think it has to do with a network problem. We figured there is an F5 reverse-proxy which is not properly set up to handle websockets
The answer didn't make any sense now that I've seen the code that's why I've edited it. I only answered because I could't comment on your question and ask you for the code.
Your calling code seems correct and the server side of things the process of response should be handled automatically by the framework, you only need to return some JSON in the controller method.
I instantiated a copy of the server (just changed the adapters to run it locally) and the server replied to the web socket requests (although I only tested the route '/index').
Normally when the problems are caused by a reverse proxy the socket simply refuses to connect and you can't even send data to server. Does the property "socket.socket.connected" returns true?
The best way to test is to write a small node application with socket.io client and test it in the same machine that the application server is running, then you can exclude network problems.

Resources