-
I have been working on a chat application and everything seems to work in localhost but when I am in production I am having difficulty connecting my socket io client with my socket server. This is the error I am getting while making the connection
But in my network section am getting This is my client side code and my REACT_APP_SOCKET_URL is
My server side code
What have I tried? I have tried many things actually. I thought there was something with CORS so enabled everything with I also disabled the Really could use some help here. Really getting frustrated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi! That's weird indeed. The "server error" is created here: socket.io/packages/engine.io-client/lib/socket.ts Lines 589 to 592 in b9b1613 Which means the client has received a malformed packet (the "error" packet type is not used during the communication, only when parsing). Could you please share the body of the HTTP request? |
Beta Was this translation helpful? Give feedback.
-
Very silly mistake on my behalf. I forgot that I have nginx reverse proxy in place. So I had to add a section for socket io in my nginx default.conf file.
And it worked like a charm. |
Beta Was this translation helpful? Give feedback.
Very silly mistake on my behalf. I forgot that I have nginx reverse proxy in place. So I had to add a section for socket io in my nginx default.conf file.
And it worked like a charm.