reactjshttpsocket.iows

Socket io request getting blocked


While connecting to my socket.io server from react app, request is getting blocked. Its working with localhost but when i am trying from VPS, its not working.

From VPS:

enter image description here

enter image description here

From localhost:

enter image description here

http://server_ip:8007/socket.io/?EIO=4&transport=polling

above url returning valid response 0{"sid":"VaHqLXI5UVRRaeUAAAAV","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000,"maxPayload":1000000}


Solution

  • The error ("mixed block") seems to say, you must connect using HTTPS to localhost when hosting files from an HTTPS server. Meaning, should use wss:// instead of ws://. Or connect to your vps host using http:// protocol not https://.