4ib3r / StompBrokerJS

NodeJS StompBroker
MIT License
35 stars 66 forks source link

Add support for protocol-specific configuration options #25

Closed codeaid closed 3 years ago

codeaid commented 3 years ago

Firstly thanks for the great work with the library! It's coming in handy in the project I work on.

One annoyance I encountered is that there is no way to specify protocol adapter options. SockJS, for example, logs all requests in the console and the only way to disable that is to pass the log property as an empty function to SockJS constructor. As it stands, there is no way of doing it so I've made the changes in this pull request adding support for a new broker configuration key protocolConfig.

This option allows defining adapter specific configuration, which subsequently gets merged into the constructor parameters. With this disabling logging in the SockJS adapter becomes as easy as this:

const stompServer = new StompServer({
  // ...
  protocol: 'sockjs',
  protocolConfig: {
    log: () => null,
  },
});
codeaid commented 3 years ago

I'm guessing this project is dead as the author seems to be absent? I wish someone could mark it as deprecated on NPM so that potential users know.