As far as I have seen, there is no explanation as to where we are to locate the client side script for socket.io
if node.js
is not used as the web server. I've found a whole directory of client side files, but I need them in a combined version (like it's served when using node.js webs servers). Any ideas?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
- How to verify laravel passport api token in node /
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
- Get file created date in node
socket.io.js is what you're going to put into your client-side html. Something like:
my script is located:
copy that file to where you want your server to serve it.
The best way I have found to do this is to use bower.
and include the following in your app's HTML:
That way you can treat the socket.io part of your client the same way you treat any other managed package.
if you use https://github.com/btford/angular-socket-io make sure to have your index.html like this:
If you are using bower.json, add the socket.io-client dependency.
Then run bower install to download socket.io-client.
Then add the script tag in your HTML.
For everyone who runs wiredep and gets the "socket.io-client was not injected in your file." error:
Modify your wiredep task like this:
I think that better and proper way is to load it from this url
on the domain where socket.io runs. What is positive on this solution is that if you update your socket.io npm module, your client file gets updated too and you don't have to copy it every time manually.