I have a web client (Angular) that after deployment to production fails to get any messages from a Socket.io server. It uses connect('https://myserver.com')
.
The odd thing is, I have no problem connecting and communicating for the same address via Postman, so the Socket.IO server is fully available, and I get all the messages from the server.
I cannot understand how this is possible. Is there something extra that a web client for Socket.IO needs to do? Or what kind of specific Postman might be doing that I am missing in my web client?
The client keeps making polling requests like this:
https://myserver.com/socket.io/?EIO=4&transport=polling&t=OYcA8Kb
...which all report 200, success, but no messages exchanged. Looks like the connection is successful, but messages exchange doesn't work. However, each response contains the entire website, for some reason.
Locally, the client works without issues, i.e. all event listening is setup correctly.
UPDATE
Once I added connect_error
handler in the client, I'm getting:
Error: server error
at p.onPacket (main.3bb22659dbeb7e15.js:1:31229)
at He.emitReserved.He.emit (main.3bb22659dbeb7e15.js:1:17091)
at Ui.onPacket (main.3bb22659dbeb7e15.js:1:18573)
at main.3bb22659dbeb7e15.js:1:24378
at Array.forEach (<anonymous>)
at Ui.onData (main.3bb22659dbeb7e15.js:1:24210)
at He.emitReserved.He.emit (main.3bb22659dbeb7e15.js:1:17091)
at p.onLoad (main.3bb22659dbeb7e15.js:1:21055)
at u.onreadystatechange [as __zone_symbol__ON_PROPERTYreadystatechange] (main.3bb22659dbeb7e15.js:1:20498)
at XMLHttpRequest.Ue (polyfills.f09f5635ad47cbac.js:1:11493)
So the client does fail to connect, for some odd reasons.