Browser not sending any data (no errors) - websocket

So I have a faye server and a rails web application. It all worked fine till recently. Now the browser is not sending anythin to the server. There a no error not on the server not even in browser (I can create an instance of Faye.Client just fine). But when I do publish the server gets nothing. It doesn't even get anythin on the meta channel, like connect or subscribe. The thing is that if I send something with curl the server shows the message (cause I'm logging it).
I can't pin point the problem. :/

Make sure the code to send messages is being reached. Make sure your client is still valid. Test an earlier code version etc. Just a few ideas.

Solved the problem. The url to which faye was connecting was not OK, but faye failed silently because the url responded. :/

Related

NestJS 8 Socket.io 4 have socket on the server side but not being reached

NestJS 8, socket.io 4
Client user has a socket being able to receive data from the server. Not sending.
Refresh browser, the socket ID changed. Socket on the client receive 'connect' event! Yet. On server side, no logging at all. Which kind of explained point 1.
After reboot nest, problem is gone. But it comes back eventually.
My current troubleshooting direction is
Was the connection on the client dead already and it's still trying somehow to update the socket?
Browser does some caching, service worker?
I hope someone can enlighten. This happens after upgrade to socket.io 4 from 2.
It's my own stupidity.
My tenant who own the namespace. In order to reach him, I create his namespace and send message to it no matter he's online or offline.
This works fine in socket.io 2. I don't know why.
What I should do, is to check whether or not, the namespace exists or not first.
That's why the issue that I have is that the server somehow seems able to pipe message to the namespace, yet the tenant cannot send the message to the server because the tenant was not initialized properly in the nest gateway.

Faye chat application failing on web server (bluehost)

This is more of a network question , I believe. Not sure what the issue is. I have a chat application which uses faye and it runs fine on my system(rails app)
with localhost:3000 having faye mounted on it.I recently deployed this rails app onto bluehost server and when I try to use the faye client on browser ,its giving me this error:
WebSocket connection to 'ws://chat.xyz.com/faye' failed: Error during WebSocket handshake: Unexpected response code: 500
The below requests\handshakes keep on repeating.
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp3
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp4
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp5
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp6
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp7
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp8
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp9
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ng%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp10
And the failed handshakes\requests keep on getting repeated. Seeing the same on server logs also(except the 500 message obviously). The logs dont give any error apart from these repeats
Is it because of proxy\firewall issue. I recently came across an article :
http://www.infoq.com/articles/Web-Sockets-Proxy-Servers
I am not sure whether its related to blocking of requests by proxy servers.
Tried switching to secure protcol. https. Didn't help.
I use a simple client like this:
var client = new Faye.Client('http://chat.xyz.com/faye');
Any help would be great.

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.

Are there any reasons why Heroku might silently reject requests with status code 400?

I'm trying to diagnose an issue whereby an embedded device running an HTTP client to issue requests to a Node.js Web application running on Heroku is receiving empty responses with status code 400.
The problem I'm facing is that the presumably failing requests do not even appear in the Heroku logs, so it's certainly not the Web application code returning those 400s.
On the other hand issuing requests to the Web application from a browser works just fine and the requests do appear in the Heroku logs.
I'm trying to figure out whether the embedded client is really sending requests at all and I'm wondering if there are any reasons why Heroku might send back those 400s without the requests even appearing in the logs.
The cause was related to a badly implemented HTTP client in the device that was issuing requests omitting the host header.
Adding the header solved the problem.

Continuous websocket traffic with SignalR

I've been using SignalR successfully for some time using serverSentEvents transport. I've just installed my application on Windows Server 2012 RC and now when I connect SignalR is using websockets (as you'd expect).
It appears to work OK except there is a continuous stream of websocket traffic between server and browser - about once a second it's sending about 90 bytes.
From the debugger window in Chrome, it looks like it's sending a connection upgrade request each time.
I am successfully receiving messages sent by the server, but I seem to be worse off than when using long polling.
The browser is Chrome version 19.0.1084.52.
Any idea why this is happening?
This was down to my own stupidity - but I thought I'd answer in case anyone else has the same problem.
I had built the solution SignalR.Hosting.AspNet instead of SignalR.Hosting.AspNet45
So the method AcceptWebSocketRequest was throwing a NotSupportedException; because the client websocket upgrade failed, it just tried again about a second later.
I guess the client could show an error or something in this case to aid debugging.

Resources