StompProtocolAndroid
StompProtocolAndroid copied to clipboard
Can't send multiple STOMP messages
If I do this
mStompClient = Stomp.over(WebSocket.class, endpoint);
mStompClient.connect();
and immediately following with
switch (lifecycleEvent.getType())
{
case OPENED:
mStompClient.send(stomp_p2p_channel, msg_body);
then message is sent successfully.
If i do sending one more time (after 5 sec)
mStompClient.send(stomp_p2p_channel, msg_body);
the message is NOT sent, despite connection is still alive.
Bug?
Try
mStompClient.send(stomp_p2p_channel, msg_body).subscribe();
Thank you, this work!
But, could you explain why client need to subscribe for each sent message?
send
returns an Observable, which means it shouldn't do anything unless subscribed to. If you don't know what an Observable is, read this.