I have an issue where when i call socket.emit() on the socket object after i instantiate the socket object it does not do anything. Like calling the socket emit function from the constructor when React app loads. But when i attach the same emit to a click event like clicking a button then it works correctly. Is this because of some some asynchronous process inside the socketio module?
for eg:
socket = io(<someurl>);
socket.emit('something') // this does not work
but calling the same thing inside a click event fires the emit.