socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Client library is sent without cache headers

Open markushedlund opened this issue 14 years ago • 3 comments

<script src="/socket.io/socket.io.js"></script> this Javascript file is sent to the client without cache headers (ETag, Last-Modified etc).

Since this is quite large (70kB), it would be nice to allow the clients to cache it. Or is there a reason this isn't done?

Also: Would be nice if the docs said something about that it magically creates a route for this file. :)

markushedlund avatar May 30 '12 21:05 markushedlund

There is a wiki on how to configure socket.io and its cache headers,

Same goes for the magic route

Sent from my iPhone

On 30 mei 2012, at 23:30, Markus [email protected] wrote:

<script src="/socket.io/socket.io.js"></script> this Javascript file is sent to the client without cache headers (ETag, Last-Modified etc).

Since this is quite large (70kB), it would be nice to allow the clients to cache it. Or is there a reason this isn't done?

Also: Would be nice if the docs said something about that it magically creates a route for this file. :)


Reply to this email directly or view it on GitHub: https://github.com/LearnBoost/socket.io/issues/903

3rd-Eden avatar May 30 '12 21:05 3rd-Eden

For anyone else with the same issue:

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

Code:

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'
]);

markushedlund avatar May 31 '12 09:05 markushedlund

The docs are in the wiki. There's production settings you can enable to ensure the file is served like you suggest.

On Wed, May 30, 2012 at 4:30 PM, Markus Hedlund < [email protected]

wrote:

<script src="/socket.io/socket.io.js"></script> this Javascript file is sent to the client without cache headers (ETag, Last-Modified etc).

Since this is quite large (70kB), it would be nice to allow the clients to cache it. Or is there a reason this isn't done?

Also: Would be nice if the docs said something about that it magically creates a route for this file. :)


Reply to this email directly or view it on GitHub: https://github.com/LearnBoost/socket.io/issues/903

Guillermo Rauch LearnBoost CTO http://devthought.com

rauchg avatar May 31 '12 15:05 rauchg