androidwebsocketclientstompjava-websocket

Adding Native Headers to Stomp Client


I have been working on implementing Stomp Client on Android, I am using this library. I have successfully connected and I can receive message from the server, but now I am required to add native headers to the connection. So I edited my code to follow this pattern:

StompClient mStompClient = Stomp.over(WebSocket.class, TerminalDetails.WEB_SOCKET_URL, map);

Where "map" is an HashMap defined as below:

map.put("clientChannelId", TerminalDetails.staffId);
    map.put("clientUsername", TerminalDetails.userName);

But the header does not get to the server on connection. The back end developer says header is missing in the connection.

Has anybody faced this error before or am I doing something wrong?


Solution

  • I have read through the implementation of the Stomp library and i see that i was using the wrong header the header in the Stomp.over() static method is http header so I later passed List of StompHeader into the stompClient.connect() method.

    So, stompClient.connect(List);

    for more information, Check out the source here