I am building an app that uses socket.io — it has a React frontend and a node.js backend. It all works ok in Chrome desktop but does not work correctly in Safari desktop.
The following code fails in Safari:
// React
socket.on('connect', () => {
// do something
console.log('connect');
});
The console.log() is often not produced; it does work sometimes but inconsistently. I have found a lot of articles on the web regarding the mobile versions of browsers struggling with socket.io, but none around Safari desktop. Chrome works fine all of the time. It also works in Firefox.
Any ideas?
- Chrome: 83.0.4103.116 (Official Build) (64-bit)
- Safari: 13.1.2 (15609.3.5.1.3)
- socket.io-client: 2.3.0
- socket.io (server): 2.3.0