I am using socket.io.client in a spfx react app and getting this error while doing the socket connection:
Uncaught TypeError: Cannot read property 'sid' of undefined
Make sure you have same version of socket.io in both server side and client side. Because socket.io 2.0 is no longer compatible with 3.0. you can check it in their api docs https://socket.io/docs/v3/migrating-from-2-x-to-3-0/index.html
"socket.io-client": "^3.0.1" has this issue. it is the latest released version.
On downgrading the version to "socket.io-client": "^2.3.1" the issue got resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With