Socket.io script reduce size

socket.io source script goes like 70k, most of the comments, spaces ...

I need to reduce the script to a smaller size Some scripts do not even have spaces, and the code is all that reduces the size of the original script.

Where is the socket.io script file located to remove comments and spaces? Or is there a .io allready socket with no comments and spaces with a smaller size?

+3
source share
4 answers

There is a parameter in socket.io configuration:

https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO

default browser client minimization is false

Is Socket.IO required to send a miniature assembly socket.io.js.

You can also enable gzip compression in the library.

+10
source

The client .js file is located in *yourdir*/node_modules/socket.io/node_modules/socket.io-client/dist

There is one file called socket.io.min.js that is already known.

+4
source

The OP fixed the problem by going to /node_modules/socket.io/lib and editing "manager.js" to set both "minification" and "gzip compression" to "true". They had to do so because they used nowJS, which indirectly uses "socket.io"

This reduced the file from 70k to about 4k!

+2
source

Socket.io seems to either return some other file, or return it at runtime. I replaced socket.io.js by renaming min. cleared browser cache, but still getting the old file.

+1
source