Skip to content
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

Add Close Frame Record return type support #1497

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

chathushkaayash
Copy link

@chathushkaayash chathushkaayash commented Feb 11, 2025

Purpose

$subject

Resolves Add support for websocket close frame

Examples

1. Close the connection using NormalClosure

remote function onMessage(websocket:Caller caller, string data) returns websocket:NormalClosure {
    // ... omitted for brevity
    return websocket:NORMAL_CLOSURE;
}

2. Close the connection using CustomCloseFrame

remote function onMessage(websocket:Caller caller, string data) returns websocket:CustomCloseFrame {
    // ... omitted for brevity
    return {status: 3555, reason: "Custom close frame message"};
}

Checklist

  • Linked to an issue
  • Updated the specification
  • Updated the changelog
  • Added tests
  • Checked native-image compatibility

@ayeshLK ayeshLK marked this pull request as ready for review February 19, 2025 04:52
@ayeshLK ayeshLK requested review from Bhashinee and removed request for shafreenAnfar and ThisaruGuruge February 19, 2025 04:52
ayeshLK
ayeshLK previously approved these changes Feb 25, 2025
Copy link
Member

@ayeshLK ayeshLK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

MohamedSabthar
MohamedSabthar previously approved these changes Mar 3, 2025
@chathushkaayash chathushkaayash dismissed stale reviews from MohamedSabthar and ayeshLK via 20eb8c2 March 3, 2025 04:43
Copy link

sonarqubecloud bot commented Mar 3, 2025

Comment on lines +1137 to +1139
result = wsService.getRuntime().callMethod(
connectionInfo.getWebSocketEndpoint(), WebSocketConstants.RESOURCE_NAME_CLOSE,
strandMetadata, status, reason);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we invoke the WebSocket close resource here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the user sends a close frame, we call this method to actually close the connection.

Copy link
Member

@Bhashinee Bhashinee Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but in this case we are the ones who send a close frame right? Not receiving a close frame. Isn't that correct?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but in this case we are the ones who send a close frame right? Not receiving a close frame. Isn't that correct?

Correct. We send the close frame.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had an offline discussion with @Bhashinee and decided to implement a new sendCloseFrame method instead of reusing externClose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for websocket close frame
4 participants