More specific types
Description
Why is StompHeaders an optional argument in all methods? By specification in many methods, headings are REQUIRED.
So, it is probably better to make the REQUIRED headers for the api (with compatibility with older versions of the protocol), and also specify the types for each type of message.
For example SEND:
interface StompSendHeaders extends StompHeaders {
destination: string;
transaction?: string;
}
public send(headers: StompSendHeaders, body?: string): void {
console.log("Send!", body, headers);
}
Versions
node-stomp-protocol: 0.3.8
This is a good point for an improvement. Feel free to submit a PR.
Just published v0.4.0. This version includes a first breaking change that makes all StompHeaders params mandatory. There should have been an exception for DISCONNECT frame, that hasn't mandatory headers, except when you need to send back a receipt ID, but in order to keep a cleaner and uniform API, it also needs (maybe empty) headers.