josephg / josephg/node-browserchannel

Provide caching headers

Open
#11 3 comments 0 reactions 0 assignees View on GitHub
needs further review
Dominant language
CoffeeScript
Stars
288
Forks
44
PR merge metrics
No merged PRs in 30d

Description

So the current implementation gives the client an etag which is already nice but the browser will still send out a request. Using the connect.static maxAge parameter sets the caching headers so the browser will not even send a request for the code, speeding up the connection.

https://github.com/senchalabs/connect/blob/a9f20e450b8c197e22da41d3d1d610685878489d/lib/middleware/static.js#L168

Since you're not using connect.static I think it may be enough to just add the header at

https://github.com/josephg/node-browserchannel/blob/bfc517f7250eaf17ba6ade4ec02e37ac58eab0bd/lib/server.coffee#L840

but there may be some subtlety involved.

It is desirable to turn off this header while developing the client code, so some sort of option would have to be settable, but I think setting the default to at least a day is probably a good idea.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.