Socket.io: Io Is Not Defined
So, I am trying to get data on my node.js file instead of directly getting it on my JS file. I a using Socket.io 2 here, Below is a snapshot of my code and this is also the first
Solution 1:
Two things which are wrong .
First Consider using Socket.io-client instead of Socket.io.
Second and very much important.
Never ever make API calls inside your routes. This will trigger a API call everytime user opens your website or webpage
You can also expect an error "Unexpected headers" or something like that.
Always, Try do declare it outside any routes in your NodeAPP.
Same goes for socket.io as well
Post a Comment for "Socket.io: Io Is Not Defined"