Unable to receive subscriptions
Opened this issue · 0 comments
IgnacioHR commented
I'm trying to write a test case for my application using MockStompBroker and I can't detect when the subscribed()
method is called.
This is what I'm doing:
- The test case is setting up the server
stompMock_editor = new msb({
port: 8333,
endpoint: '/v1/socket/connect'
});
...
stompMock_editor.newSessionsConnected().then((s) => {
s.forEach((sessionId) => {
console.log('sessionId: ' + sessionId);
stompMock_editor.subscribed(sessionId).then((u) => {
console.log('Subscribed' + u);
});
});
});
- The main class (angular application) is opening the connection, and the newSessionsConnected() method is called later. The main class also subscribes to a topic in the onConnect event handler. The topic is, for example 'private_topic'
Looking at the source code, I see the implementation of newSessionsConnected() is declared async and it waits for connections that might come later. But the implementation of subscribed() is not async and does not await for subscriptions so it looks like it is not written to be used the same way?
At a certain point, I can now receive subscribed() events, by changing the code a bit, but cannot retrieve the topic the client application has subscribed to so I can't properly prepare test cases where the client subscribe to multiple topics