Allow sending headers with the disconnect frame

This commit is contained in:
Ilja
2019-04-01 10:14:53 +02:00
committed by Rossen Stoyanchev
parent b0b6423714
commit 08f1cb454a
3 changed files with 35 additions and 0 deletions

View File

@@ -362,9 +362,17 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
@Override
public void disconnect() {
disconnect(null);
}
@Override
public void disconnect(@Nullable StompHeaders headers) {
this.closing = true;
try {
StompHeaderAccessor accessor = createHeaderAccessor(StompCommand.DISCONNECT);
if (headers != null) {
accessor.addNativeHeaders(headers);
}
Message<byte[]> message = createMessage(accessor, EMPTY_PAYLOAD);
execute(message);
}

View File

@@ -116,6 +116,12 @@ public interface StompSession {
*/
void disconnect();
/**
* Disconnect the session by sending a DISCONNECT frame.
* @param headers the headers for the disconnect message frame
*/
void disconnect(StompHeaders headers);
/**
* A handle to use to track receipts.