-
Notifications
You must be signed in to change notification settings - Fork 37
Add connectionClosureTimeout service config annotation
#1542
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
Merged
ayeshLK
merged 32 commits into
ballerina-platform:main
from
chathushkaayash:connection-closure-timeout
Apr 8, 2025
Merged
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
441de42
[Automated] Update the native jar versions
chathushkaayash 9c23d55
Add connection closure timeout configuration to WebSocket service
chathushkaayash 3e71ae4
Add default connection closure timeout constant
chathushkaayash 06cf25d
Merge branch 'main' into connection-closure-timeout
chathushkaayash 23b90ea
Merge branch 'main' into connection-closure-timeout
chathushkaayash 0d44e7e
Merge branch 'main' into connection-closure-timeout
chathushkaayash d88e8f3
[Automated] Update the native jar versions
chathushkaayash 9d29c75
Update changelog
chathushkaayash 5b6c942
Refactor connection closure timeout handling in WebSocket connector
chathushkaayash cc266f4
Merge branch 'main' into connection-closure-timeout
daneshk fb232b6
Update the spec
chathushkaayash 597f4ac
Merge branch 'main' into connection-closure-timeout
chathushkaayash c86d100
Update sendCloseFrame method to use connectionClosureTimeout
chathushkaayash 27442b9
Add test for connection closure timeout when returning close frames
chathushkaayash e8cfcf8
[Automated] Update the native jar versions
chathushkaayash 6db92c9
Bump version to 2.15.0
chathushkaayash 8912ad0
Update the behavior of handling negative values in connectionClosureT…
chathushkaayash d0a8285
Add compiler plugin validation for connection closure timeout
chathushkaayash ad49678
Remove unreachable exception in findTimeoutInSeconds
chathushkaayash 1af2fff
Add test for handling negative timeout values in close method of the …
chathushkaayash bf91804
Remove unnecessary variable assignment
chathushkaayash 81062ca
Remove unnecessary parenthesis
chathushkaayash ccbaef3
Refactor isAnnotationPresent method
chathushkaayash 7be39da
Handle ArithmeticException in findTimeoutInSeconds method
chathushkaayash eead202
Enhance WebSocketUpgradeServiceValidatorTask
chathushkaayash 2b1ff8e
Refactor getAnnotationValue method
chathushkaayash 2e2dfb1
Improve timeout handling in WebSocket close operations and add tests …
chathushkaayash 648bb8f
Refactor findTimeoutInSeconds method to handle exceptions
chathushkaayash b7f3a73
Refactor WebSocketUpgradeServiceValidatorTask to use SyntaxKind for f…
chathushkaayash 47f0ef3
Refactor getAnnotationValue function to use equal symbol
chathushkaayash a908f5c
Add note on connectionClosureTimeout validation in WSServiceConfig do…
chathushkaayash 89e8d2b
Refactor isAnnotationFieldPresent to use syntax kind checking
chathushkaayash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Copyright (c) 2025, WSO2 LLC. (http://www.wso2.org). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| import ballerina/lang.runtime; | ||
| import ballerina/test; | ||
|
|
||
| listener Listener connectionClosureTimeoutListener = new (22100); | ||
|
|
||
| @ServiceConfig { | ||
| connectionClosureTimeout: 10 | ||
| } | ||
| service / on connectionClosureTimeoutListener { | ||
| resource function get .() returns Service|UpgradeError { | ||
| return new ConnectionClosureTimeoutService(); | ||
| } | ||
| } | ||
|
|
||
| service class ConnectionClosureTimeoutService { | ||
| *Service; | ||
|
|
||
| remote function onMessage(Caller caller, string data) returns error? { | ||
| _ = start caller->close(); | ||
| runtime:sleep(1); | ||
| test:assertTrue(caller.isOpen()); | ||
| runtime:sleep(10); | ||
| test:assertTrue(!caller.isOpen()); | ||
| } | ||
| } | ||
|
|
||
| @test:Config { | ||
| groups: ["connectionClosureTimeout"] | ||
| } | ||
| public function testConnectionClosureTimeoutFromServer() returns Error? { | ||
| Client wsClient = check new ("ws://localhost:22100/"); | ||
| check wsClient->writeMessage("Hi"); | ||
| runtime:sleep(20); | ||
| } |
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.