I can connect socket.io through this url: localhost/socket.io/socket.io.js But I need minified version! localhost/socket.io/socket.io.MIN.js is not works.
In order to do it, you need to create an index. js file and install socket.io and express. You can use the following command: touch index. js && npm install express socket.io && npm install --save-dev nodemon .
Socket.IO intercepts requests to /socket.io to serve the files it needs. It normally serves them from:
./node_modules/socket.io/node_modules/socket.io-client/dist
However, as said in Socket.IO's wiki, you can serve the files yourself if you prefer.
The files you need are in the /dist folder in the socket.io-client repo.
If you want to force production settings all the time, you can just add this to your node app right before calling listen():
io.enable('browser client minification'); // send minified client
io.enable('browser client etag'); // apply etag caching logic based on version number
io.enable('browser client gzip'); // gzip the file
io.set('log level', 1); // reduce logging
io.set('transports', [ // enable all transports (optional if you want flashsocket)
'websocket'
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling'
]);
Latest socket.io.js minified version here, as of today (version 0.9.16):
http://cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With