For example, let's say we're trying to use socket.io.
In the html file served to the client, we include the following in the file.
So two questions regarding this:
When the html file gets served to the client, it loads the socket.io.js resource (http://localhost:8080/socket.io/socket.io.js) without triggering the requestHandler in server.js (I have a log statement for any request that hits localhost:8080). How does this resource load on the client without triggering the requestHandler?
Where does Node find the socket.io.js resource that is required by the client?
Assuming you are using one of the basic Socket.io examples, this is because Socket.io overrides your handle with it's own and won't run your handler if the request is for something that socket.io manages.
When you call
.listen(80) it will set up all of the handlers it needs to process data and serve the client JS file.
There is currently no discussion for this recipe.
This recipe can be found in it's original form on Stack Over Flow.