Without STOMP , with native Spring Boot WebSocket API#2
Open
abhisekmohantychinua wants to merge 10 commits intoali-bouali:mainfrom
Open
Without STOMP , with native Spring Boot WebSocket API#2abhisekmohantychinua wants to merge 10 commits intoali-bouali:mainfrom
abhisekmohantychinua wants to merge 10 commits intoali-bouali:mainfrom
Conversation
abhisekmohantychinua
commented
May 23, 2024
- Read the reference document for Spring Boot here
- Read reference document for Javascript here
- Pre existing stomp configuration has been removed - New configuration with the help of basic Spring WebSocket API - MyHandler.java which handles the different events during connection
- Pre existing controller has been removed - Now login is implemented by overriding afterConnectionEstablished method. - The above method is compatible for token based authentication. - Instead of broker a List of WebSocketSession has been used to keep connected sessions.
- Pre existing event handler - Now logout is implemented by overriding afterConnectionClosed method. - Disconnected session has been removed from stored list.
- java.lang.IllegalStateException: Message will not be sent because the WebSocket session has been closed - The exception is fixed by sending messages to existing session.
- Now message has been sent to all connected sessions
- This is implemented by overriding handleTextMessage. - Manually publishing the message to all the sessions
- Optimized previous Javascript code - Wrapped up with windows.onload
- Previous libraries AJAX, Stomp has been removed - Instead of them native WebSocket class has been used - Unnecessary functions are removed and onMessageReceived, onError has been mapped to corresponding socket method
- The payload.body has been replaced by payload.data - stompClient variable has been replaced by socket - No additional changes has been added
haneesh9840
approved these changes
Nov 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.