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

Integrate websockets protocol support #119

Merged
merged 318 commits into from
Jul 2, 2024

Conversation

hasathcharu
Copy link
Contributor

@hasathcharu hasathcharu commented Jun 20, 2024

Purpose
This is to integrate websockets protocol support for client generation with AsyncAPI specification and vice versa. Moreover, this also upgrades the APICurio version to the latest version (2.0.4) as well.

Fixes:

Related Issues
ballerina-platform/ballerina-library#4290

docs/spec/spec.md Outdated Show resolved Hide resolved
docs/spec/spec.md Outdated Show resolved Hide resolved
docs/spec/spec.md Outdated Show resolved Hide resolved
docs/spec/spec.md Outdated Show resolved Hide resolved
docs/spec/spec.md Outdated Show resolved Hide resolved
_ = users.remove(callerId);
}

// remote function onClose(websocket:Caller caller) returns websocket:Error? {
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason for commenting out these lines? I think it's better if we have this part as well. To remove the users from the map when the connection is closed by the client.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason for this is that AsyncAPI tools currently doesn't support built-in functions in the ballerina/websocket library.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I am not sure whether I understood this. But this onClose is there in the WebSocket module which gets dispatched when there is a connection closure frame from the client. This does not have to be related to AsyncAPI tools right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but according to this function [1], we are explicitly disallowing built-in methods in the websocket service. This may be due to the difficulty of mapping the responses of these functions.

[1] https://github.com/hasathcharu/asyncapi-tools/blob/605bffe350b8f3d8c7f475184ffd201d33b4d4bf/asyncapi-cli/src/main/java/io/ballerina/asyncapi/websocketscore/generators/asyncspec/service/AsyncApiRemoteMapper.java#L249C1-L254C6

Copy link
Member

Choose a reason for hiding this comment

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

Ohh, this is wrong. We should not throw any errors if those functions are there, we basically have to skip(ignore) them when generating the Async API. Will create an issue for this. Thanks for explaining.

@Bhashinee Bhashinee merged commit 60db22c into ballerina-platform:main Jul 2, 2024
3 checks passed
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.

6 participants