ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
137 stars 64 forks source link

Implement dispatcher stream id in the WebSocket protocol. #6757

Open Bhashinee opened 3 months ago

Bhashinee commented 3 months ago

Description: The purpose of this is to address the issue where, if two custom remote functions return the same message type, the generated AsyncAPI client cannot determine which response corresponds to which request. So the plan was to do the validation at the compile time. To give an error if two remote functions have the same return type and there isn't a dispatcher stream defined.

Bhashinee commented 3 months ago

Validation at compile time doesn't work in this case. The service configuration annotations are defined in the first service, which is dispatched for the initial HTTP request. However, the actual remote functions that are dispatched after the connection upgrades to WebSocket reside in the second service. Therefore, validation should occur at the second service. To verify if the user has defined dispatcherStreamId, the service configuration should be accessible at the second service level, but this is not possible.