4

I added this line to my index.jade file:

script(src="/socket.io/socket.io.js")

And somehow it automagically knew how to serve that Javascript file to my client. How does that work?

1 Answer 1

6

Socket.io adds a request handler to the server. See:

https://github.com/learnboost/socket.io/blob/master/lib/manager.js#L90

The handler deals with any requests that begin with /socket.io and handles them (e.g. serving up the socket.io.js file from wherever the module is installed)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.