Git Product home page Git Product logo

Comments (4)

grs avatar grs commented on June 26, 2024

Are you waiting for the connection to be opened before sending?

from rhea.

TezzM0 avatar TezzM0 commented on June 26, 2024

Thanks so much for the help @grs - this appears to have been the problem.

I previously had:

// snip - set up connection
connection.connect();
sender.open();
sender.send(message);

Which appears to work somewhat - the message is sent successfully, as long as it doesn't exceed max_frame_size of the server.

I've now changed it to:

// snip - set up connection
connection.connect();
sender.open();
sender.once('sendable', () => {
    sender.send(message);
});

Now it picks up the max_frame_size from the server side and splits the large message up correctly.

All that being said - I think there is a problem here. Shouldn't I be able to set the max_frame_size on the connection myself?

This test case fails for me:

const container = require('rhea');

describe('Connection Options', () => {
  it('should set max_frame_size', () => {
    let connection;
    try {
      connection = container.connect({ host: '127.0.0.1', port: 5672, max_frame_size: 1000 });
      expect(connection.max_frame_size).toBe(1000);
    } finally {
      if (connection) {
        connection.close();
      }
    }
  });
});

I feel like if I'm not supposed to set max_frame_size on the client side, then it shouldn't be an option in the library, and if I'm allowed to set it then it should be honoured.

Again, I really appreciate the help!

from rhea.

grs avatar grs commented on June 26, 2024

Each side sets its max-frame-size independently. So if you set it on your connection, that is the max frame size that the broker is allowed to send to you. You cannot alter the max-frame-size the broker will accept by setting the value on your side of the connection. (If that is something that can be configured it would be configured on the broker side)

from rhea.

TezzM0 avatar TezzM0 commented on June 26, 2024

Ah that makes sense. Thanks again!

Perhaps it could be named something like max_receive_frame_size, or have a comment indicating this.

from rhea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.