we set up websocket topic with Spring websocket, and then the client side is using Stomp.js to subscribe it;
it works fine if connect to the websocket service directly; but now
we set up
Kong as the API Gateway in front of the websocket service; it
needs to set header "Host:
websocket.com" when connect to it;
But it doesn't work with Stomp.js;
var url='http://xx.xx.xx.xx:8000/websocket/tracker';
var socket = new SockJS(url);
stompClient = Stomp.over(socket);
var thisheaders={
Host:'websocket.com'
};
stompClient.connect(thisheaders, function (frame) {
setConnected(true);
console.log('Connected: ' + frame);
stompClient.subscribe('/topic/greetings', function (greeting) {
showGreeting(JSON.parse(greeting.body).content);
});
});
Does anyone know how to add the headers for it? Or the Stomp.js just doesn't support to add headers?
Thanks!