spdy
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
debug | 4.3.4 | 12.94 kB | MIT | prod | |
handle-thing | 2.0.1 | 4.01 kB | MIT | prod | |
http-deceiver | 1.2.7 | 4.46 kB | MIT | prod | |
select-hose | 2.0.0 | 5.23 kB | MIT | prod | |
spdy-transport | 3.0.0 | 32.76 kB | MIT | prod |
'spdy' is an npm package that enables the creation of HTTP2/SPDY servers in node.js. It provides a natural http module interface and integrates a fallback to regular https for browsers that do not yet support these protocols. This tool is versatile as it extends support for both http/2 (h2) and different versions of spdy (2,3,3.1). Popular web application frameworks like Express.js are compatible with the 'spdy' module.
To use the 'spdy' module, you have to first install it using npm and then require it in your node.js server file. Here's a brief example of how you can use 'spdy' to build an HTTP2/SPDY server:
var spdy = require('spdy'),
fs = require('fs');
var options = {
key: fs.readFileSync(__dirname + '/keys/spdy-key.pem'),
cert: fs.readFileSync(__dirname + '/keys/spdy-fullchain.pem'),
spdy: {
protocols: [ 'h2', 'spdy/3.1', ..., 'http/1.1' ],
plain: false,
'x-forwarded-for': true,
connection: {
windowSize: 1024 * 1024,
autoSpdy31: false
}
}
};
var server = spdy.createServer(options, function(req, res) {
res.writeHead(200);
res.end('hello world!');
});
server.listen(3000);
In the above code snippet, an HTTPS server is created with the help of 'spdy'. The options object includes the private key and certificate required for the server, as well as several SPDY-specific options, which can be customized as per your requirements.
For detailed documentation and more usage examples, you can visit the page for the 'spdy' module on GitHub. The docs provide a detailed usage guide, API reference, and examples for both server and client usage along with robust explanations for various options and features like push streams, trailing headers, and error handling.