Class BatchedSend

Batch messages in batches on a stream

Declaration

class BatchedSend
source link

Documentation

This takes an IOStream and an interval (in ms) and ensures that we send no
more than one message every interval milliseconds.  We send lists of
messages.

Batching several messages at once helps performance when sending
a myriad of tiny messages.

Examples

>>> stream = yield connect(address)
>>> bstream = BatchedSend(interval='10 ms')
>>> bstream.start(stream)
>>> bstream.send('Hello,')
>>> bstream.send('world!')

On the other side, the recipient will get a message like the following::

    ['Hello,', 'world!']

Methods

Reexports