How to use the uws.SLIDING_DEFLATE_WINDOW function in uws

To help you get started, we’ve selected a few uws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github primus / primus / transformers / uws / server.js View on Github external
module.exports = function server() {
  const opts = Object.assign({
    perMessageDeflate: !!this.primus.options.compression,
    maxPayload: this.primus.options.maxLength
  }, this.primus.options.transport);

  this.service = native.server;

  let flags = 0;

  if (opts.perMessageDeflate) {
    flags |= uws.PERMESSAGE_DEFLATE;
    if (opts.perMessageDeflate.serverNoContextTakeover === false) {
      flags |= uws.SLIDING_DEFLATE_WINDOW;
    }
  }

  const group = native.server.group.create(flags, opts.maxPayload);
  let upgradeReq = null;

  native.server.group.onConnection(group, (socket) => {
    const spark = new this.Spark(
      upgradeReq.headers,               // HTTP request headers.
      upgradeReq,                       // IP address location.
      url.parse(upgradeReq.url).query,  // Optional query string.
      null,                             // We don't have an unique id.
      upgradeReq,                       // Reference to the HTTP req.
      socket                            // Reference to the socket.
    );

uws

## Go to [https://github.com/uNetworking/uWebSockets.js](https://github.com/uNetworking/uWebSockets.js).

Apache-2.0
Latest version published 4 years ago

Package Health Score

61 / 100
Full package analysis