i got this error while i trying the first step to write a socket.io code, i'm actually following the guide in the officially web of socket.io and then when i run my code, in my terminal show up the error "cannot call method 'on' of undefined" in line 18. why that's happen?? i was installed the socket.io correctly before. and here is the screenshot in here
any suggest and advice will be appreciate it so much and thanks in advance.
Your screenshot indicates that io.socket
doesn't exist. From that examples page and a quick look at the source it would appear that perhaps you meant io.sockets
?
io.socket
doesn't appear to exist, hence the "cannot call method 'on' of undefined" error.