In Socket.io documentation, in ‘Get Started’ guide, they advice you to implement this script on the client side:
<script src="/socket.io/socket.io.js"></script>
Where is its source come from? What is this /socket.io/socket.io.js
is pointing at sice we are not creating any file like this one?
That’s assuming you put it in a folder named socket.io
in your html root. Pretty dumb assumption. Bad doc writer, no biscuit.
If you’re not using a module bundler, I suggest using a CDN link
So how is the app still working since I do not have any socket.io folder in my html root?
@bartekw2213, that’s a great question. I was wondering the same thing while working on one of the projects for the updated curriculum.
If you’re using Socket.io with Node and http server or Express, /socket.io/socket.io.js
is served to the client automatically. Answers in these posts have a bit more information about it:
Would be nice if there was a sentence or two in the documentation about this.
1 Like