-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.2.x: Okhttp stomp protocol implementation #127
base: 0.2.x
Are you sure you want to change the base?
Conversation
...t-protocol-stomp/src/test/java/com/tinder/scarlet/stomp/okhttp/OkHttpStompIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...t-protocol-stomp/src/test/java/com/tinder/scarlet/stomp/okhttp/OkHttpStompIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...-protocol-stomp/src/main/java/com/tinder/scarlet/stomp/okhttp/support/StompMessageDecoder.kt
Outdated
Show resolved
Hide resolved
...rotocol-stomp/src/main/java/com/tinder/scarlet/stomp/okhttp/client/OkHttpStompMainChannel.kt
Outdated
Show resolved
Hide resolved
...t-protocol-stomp/src/main/java/com/tinder/scarlet/stomp/okhttp/client/WebSocketConnection.kt
Outdated
Show resolved
Hide resolved
...rotocol-stomp/src/main/java/com/tinder/scarlet/stomp/okhttp/client/OkHttpStompMainChannel.kt
Outdated
Show resolved
Hide resolved
...-protocol-stomp/src/main/java/com/tinder/scarlet/stomp/okhttp/support/StompHeaderAccessor.kt
Show resolved
Hide resolved
Hi everyone! Is there any estimate when would be merged @zhxnlai? This would help me a lot and solve all the problems in my life :) |
Increate targetSdk, compileSdk and build tools vesrions.
@miguelhrocha Hi, I think you can just use these changes and create your own module in your project before the maintainer accepts it. It's going to be faster. |
Update deps libs Optimize imports Remove extra
Update okhttp stomp client Update stomp core Add message builder. Change stomp message model. Update StompHeaderAccessor.
Fix code style Add encode and decode implementation Fix naming
…ader Fix bug with update read time Fix demo Code style update
This reverts commit 81e289a.
Refactoring packages Refactoring and add documentation update stomp message encoder refactoring and update code style add method for sent byte array to stomp sender make ClientOpenRequestHeaderFactory typealias as private fix code style
refactoring stomp header accessor refactoring Change unknown stomp command type to heartbeat
Make method handle result as nullable add java doc to IdGenerator Refactoring stomp message decoder and add tests add copyright refactoring packages remove extra update test deps fix crash fix bug with sending bytes
rename test method add unsubscribeAll method add to string implementation for stomp header and messages add awaitCountAtLeast method move okhttp stomp integration test to another module remove extra line in test method Incapsulate the logic of calculating "whether to send a heartbeat settings to server" Add field shouldRetryAfterError Add setting shouldRetryAfterError to configuration Refactoring OkHttpStompMainChannel Add method disconnect with disposing logic Change InnerWebSocketListener class modifier to private Change string regex to use char Add overloading method "of" in StompHeaderAccessor
Change queue to use topic Add overloading. method awaitCountAndCheck with sleep strategy Update StompIntegrationTest Add message to require Fix code style Rewrite stomp message decoder * Rewrite stomp message decoder using okio buffer instead of java buffer * Update okio version Add method awaitCountAndCheck with wait strategy Change using system time millis to use nanoTime * change using system time millis to use nanoTime * add test for websocket connection * fix code style Remove extra method Remove extra comment
Hey @HaronCode thanks for the advice! I did exactly what you proposed, and now I am able to connect successfully to my Spring Boot backend :) I can successfully send messages, but I am not able to receive anything broadcasted from the backend. Were you able to test the integration of a subscription towards a topic? I seriously can't see what's wrong with my code, looking that I can subscribe without any problems to the This is my service for example:
I have the following configuration:
and this is the instantiation of the Topic
I am managing everything with a Any help will be super appreciate it :) |
@miguelhrocha Don't you forget about "ApplicationDestinationPrefixes" in Spring Boot backend? And try to check the destination without prefix "/topic". I don't see any mistakes in your client code, I guess you should figure out backend settings such as broker destination prefix and application destination prefix. |
Hey @HaronCode I really appreciate all your help in this, you've been an incredible help. I think I found the issue but I think it's related to Scarlet's reflection capabilities. So your STOMP implementation works flawlessly, I was always able to receive the message from the MainChannel. However, the problem was with the subscription of the the service that receives the string, the callback was never invoked for some reason:
But I tried to do this and it works perfect, no issues at all:
Do you have any insight on why this happened? Feel free to answer that this is out of the scope of your PR, which completely is :) and I will create an issue |
I also have another question @HaronCode once again, thanks for all your help. Have you been able to reconnect the client when the Server stops the connection? I have been trying to push a |
Hey @HaronCode me again :P this is the last time I'll bother you I think. In order to kickstart a reconnection in case of an unexpected closure from the Server I had to modify your
You could add it if you see it as valuable, but I am pretty sure there most be a fancier way to achieve this :) Sadly, modifying the LifecycleState didn't work for me because if the callback of |
any update on this? I need a stomp client library |
@miguelhrocha Thank you for all your comments! I really appreciate it. I improved my implementation, I added the handler for the case with unexpected server disconnect and added integration test for it. If you use my changes can you give me some feedback, maybe you have more ideas to improve this implementation? |
Hi everyone! @zhxnlai Any news about merge this changes? |
Hi @HaronCode, thank you for your stomp implementation.
Thanks in advance. |
Hi @miguelhrocha did you figure out with this problem? I'm also able to receive messages only using ProtocolEvent. |
Hi @HaronCode, sorry for spam. I'm finally able to send and receive messages from the websocket. |
I added an implementation of the stomp protocol, which works over okhttp, because the gaziro based implementation does not support working with this protocol on top of websocket.