Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for a stripped down build with fewer transports? #1019

Closed
JulesAU opened this issue Nov 2, 2016 · 4 comments
Closed

Support for a stripped down build with fewer transports? #1019

JulesAU opened this issue Nov 2, 2016 · 4 comments

Comments

@JulesAU
Copy link

JulesAU commented Nov 2, 2016

The socket.io JS bundle is currently ~190kB. I'm wondering if there's any support for building only the required transports to help reduce the weight - other than hacking the source?

I presume many modern apps target only browsers which support websockets; so all the other fallbacks / workarounds are superfluous in that case. But socket.io remains a nice, robust, tested API to build with even in those cases.

I'm aware that it's only ~20kB when minified and gzipped; but it's still a lot of JS to parse for mobile devices.

@benjamin-albert
Copy link

benjamin-albert commented Nov 11, 2016

According to Engine.IO Goals browser support is not the only factor that can cause WebSocket connection issues.

This is why Engine.IO will use polling first and try to upgrade the connection to WebSockets in the background.

As far as I can tell the polling transports only make up 5% (10KB) of the 190KB bundle.

However being able to build without polyfills can make a significant difference.

For example just loosing the JSON3 polyfill will allow you to instantly loose 41.5KB (more than 20% of the bundle).

JSON3 is just one of the many polyfills used throughout this project, and as far as I can tell even IE 8 supports JSON.

@darrachequesne
Copy link
Member

Running webpack-bundle-size-analyzer gives:

engine.io-client: 75.62 KB (39.2%)
  engine.io-parser: 25.27 KB (33.4%)
    wtf-8: 5.96 KB (23.6%)
    blob: 2.15 KB (8.49%)
    has-binary: 1.18 KB (4.65%)
      isarray: 120 B (9.97%)
      <self>: 1.06 KB (90.0%)
    arraybuffer.slice: 725 B (2.80%)
    after: 685 B (2.65%)
    <self>: 14.62 KB (57.8%)
  yeast: 1.32 KB (1.75%)
  parsejson: 873 B (1.13%)
  parseqs: 745 B (0.962%)
  component-inherit: 146 B (0.189%)
  <self>: 47.31 KB (62.6%)
socket.io-parser: 66.81 KB (34.6%)
  json3: 42.34 KB (63.4%)
  debug: 9.95 KB (14.9%)
    ms: 2.28 KB (22.9%)
    <self>: 7.67 KB (77.1%)
  component-emitter: 2.93 KB (4.39%)
  isarray: 120 B (0.175%)
  <self>: 11.47 KB (17.2%)
debug: 10.79 KB (5.59%)
  ms: 2.65 KB (24.6%)
  <self>: 8.14 KB (75.4%)
webpack: 5.41 KB (2.80%)
  node-libs-browser: 5.17 KB (95.6%)
    process: 5.17 KB (100%)
    <self>: 0 B (0.00%)
  <self>: 241 B (4.35%)
component-emitter: 3.11 KB (1.61%)
base64-arraybuffer: 1.85 KB (0.959%)
backo2: 1.37 KB (0.708%)
has-binary: 1.3 KB (0.672%)
  isarray: 120 B (9.04%)
  <self>: 1.18 KB (91.0%)
parseuri: 1.2 KB (0.624%)
component-bind: 474 B (0.240%)
has-cors: 396 B (0.200%)
to-array: 216 B (0.109%)
indexof: 199 B (0.101%)
<self>: 24.26 KB (12.6%)

@benjamin-albert I guess a "slim" build without json3 (needed for IE6/IE7) and debug could be provided.

Related: #787

@JulesAU
Copy link
Author

JulesAU commented Nov 23, 2016

That would indeed be a pretty handy saving!

@JulesAU
Copy link
Author

JulesAU commented Nov 27, 2016

Well, I'd say this is closed thanks to the great work done in #1030 !

@JulesAU JulesAU closed this as completed Nov 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants