Hello!
I have developer’s websocket client written with Stomp and SockJS. And I need to create a performance tests for this websocket connection. But I’m facing some questions. Here is developers code:
this.stompClient = Stomp.over(new SockJS(‘https://some-address/search’));
this.stompClient.connect(headers, function (frame) {
console.log('Connected: ' + frame);
self.isConnected = true;
self.doSearch();
}, function (error) {
console.log(error)
});
},
doSearch: function () {
this.stompClient.send('/app/search', {}, JSON.stringify(request));
this.stompClient.subscribe('/topic/results/' + sessionId, function (response) {
self.handleResultsResponse(JSON.parse(response.body));
});
this.stompClient.subscribe('/topic/metadata/' + sessionId, function (response) {
self.handleMetadataResponse(JSON.parse(response.body));
});
this.stompClient.subscribe('/topic/snippets/' + sessionId, function (response) {
self.handleSnippetsResponse(JSON.parse(response.body));
});
this.stompClient.subscribe('/topic/activities/' + sessionId, function (response) {
self.handleActivitiesResponse(JSON.parse(response.body));
});
},
As you can see, first connection is established here. But URL is not starting with “ws”, this gives me first error in k6.
Then there is a sending of 1 message and then a subscription to 4 topics. Each topic then returns some messages that I want to receive and to handle.
I just wonder how can I implement this logic in k6 syntax?
- Establish connection to http url
- Send message to “/app/search”
- Subscribe for 4 topics
- Handle their responses
Or maybe I can somehow import Stomp and SockJS to be used in k6?
Thanks