Why doesn't gower install socket.io.js file?

When I run bower install socket.io

the bower installation is just fine, but when I view the installed file the socket.io.js file is missing. The problem is when trying to use bower components as dependencies in my project, I can't require('socket.io')

(using debowerify) because it looks forbower_components/socket.io/socket.io.js

Does anyone know why this is happening and what I need to do to fix it?

this is what the socket.io collector sets.

an error message appears

Error: module "./../../bower_components/socket.io/socket.io.js" not found

+3


source to share


1 answer


From the getting started guide http://socket.io/docs/# there are two components for socket.io, one for the server and client code,

The client side code is separately installed here https://www.npmjs.com/package/socket.io-client and it gives us an idea of ​​what's up ...

From the above

Separate assembly socket.io-client is automatically opened by socket.io server as /socket.io/socket.io.js



So, it's a bit of a magic that allows client side code to be accessed via server side code, which I think would explain the discrepancies in what we see in the bower_components post folder.

In the case of a node app using express, you can reference socket.io.js on the client side of the html by simply including it <script src="socket.io.js"></script>

and then referencing the supposedly global object io

that is injected by that.

Hope it helps

+3


source







All Articles