Skip to content

Sending Pre-Compressed Buffers? #1076

@ronag

Description

@ronag

Would it be possible to send pre-compressed data? i.e. if one caches messages one could cache the compressed version in order to avoid compressing during every send?

e.g.

Instead of:

cache.set(key, buf)
// ...
for (const socket of sockets) (  
  socket.send(cache.get(key)) // compressed by uws
}
cache.set(key, zlib.deflateSync(buf))
// ...
for (const socket of sockets) (
  socket.send(cache.get(key))
}

This would enable 2 things:

  • Re-use compression
  • Move compression to other thread

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions