OperationError: Cannot send message - no space in transport.

Hello Shaun,

There are a number of approaches to address this: first and foremost you could increase the windowSize session property; however, that maxes out at 255.

Detect and Respond

One approach is to catch when the API can no longer accept data, and then subscribe to the CAN_ACCEPT_DATA session event before continuing:


const doSend = () => {
  try {
    producer.log(Starting send at: ${sentCount});
    while (sentCount < producer.numOfMessages) {
      var sequenceNr = sentCount + 1;
      var message = producer.buildMessage(sequenceNr);
      producer.session.send(message);

    }
  } catch (error) {
    producer.log(Aborting send at: ${sentCount});
    producer.log(error.toString());
    producer.session.once(solace.SessionEventCode.CAN_ACCEPT_DATA, () => {
      doSend();
    });
  }
};
doSend();

This was recently discussed on another question, and a PR to demonstrate that capability in JavaScript has been made (but not yet merged at the time of this writing) here:

Prevent Buffer Overrun

Another approach, which I recently shared on a similar question was to use wrappers around the main Solace SDKs to make them async-awaitable, and only send new data when the underlying buffer can accept them.

A full description of this approach can be found here: