try catch connecting socket, if it fails then it's offline ==> everywhere that has socket.emit call should be replaced with localstorage and
A better approach is to write a lib that intercepts all socket.emit when socket isn't connected and queue the call (socket, event, data). Once back online the lib automatically emits those. Call it localSocket.
As for receiving data -> the logic upon connection should handle this.
As for receiving data -> the logic upon connection should handle this.