The issue is that the script immediately crashes as it says clientSocket is not defined when on_connect is called. I believe this is due to the fact that the define method instiantates the class before setting clientSocket to the namespace socket.
If I use socketIO.emit(. . .) inside ClientNamespace the server (nodejs socket.io 1.x) never receives any events in /clients which is what I need it to do. Am I doing something wrong or are there any workarounds?
I am creating a socket connection as follows:
The issue is that the script immediately crashes as it says
clientSocket
is not defined whenon_connect
is called. I believe this is due to the fact that thedefine
method instiantates the class before settingclientSocket
to the namespace socket.If I use
socketIO.emit(. . .)
insideClientNamespace
the server (nodejs socket.io 1.x) never receives any events in/clients
which is what I need it to do. Am I doing something wrong or are there any workarounds?