Skip to content

Commit 15546fc

Browse files
committed
Optional connect headers
1 parent 041fa3d commit 15546fc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/src/main/java/ua/naiksoftware/stomp/client/StompClient.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ public StompClient(ConnectionProvider connectionProvider) {
4343
}
4444

4545
public void connect() {
46+
connect(null);
47+
}
48+
49+
public void connect(List<StompHeader> _headers) {
4650
mConnectionProvider.getLifecycleReceiver()
4751
.subscribe(lifecycleEvent -> {
4852
switch (lifecycleEvent.getType()) {
4953
case OPENED:
50-
mConnectionProvider.send(new StompMessage(StompCommand.CONNECT,
51-
Arrays.asList(new StompHeader(StompHeader.VERSION, SUPPORTED_VERSIONS)), null).compile())
54+
List<StompHeader> headers = Arrays.asList(new StompHeader(StompHeader.VERSION, SUPPORTED_VERSIONS));
55+
if (_headers != null) headers.addAll(_headers);
56+
mConnectionProvider.send(new StompMessage(StompCommand.CONNECT, headers, null).compile())
5257
.subscribe();
5358
break;
5459

0 commit comments

Comments
 (0)