-
Notifications
You must be signed in to change notification settings - Fork 788
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
Suggestion for Enhancing Event Structure Standardization #891
Comments
I agree with this 100%. Would you be up for contributing? |
🔖 Feature description
I've noticed an opportunity to enhance the scalability and maintainability of server-client communication through the standardization of the event structure used in server-sent events. I believe this enhancement could make the system more robust and easier to work with, both for current and future contributors.
General Event Structure
Each event sent from the server follows this basic structure:
<event_type> is a string that specifies the type of the event (e.g., message, function_call, end-of-stream).
<json_formatted_data> is a JSON string that contains the event's data. The structure of this data varies depending on the event type.
Specific Event Formats
1. Message Event
Used for sending generic messages or data.
2. Function Call Event
Used for indicating a function call, including the function name and arguments.
3. End-of-Stream Event
Indicates that the stream of events has concluded.
Rationale
Implementing a uniform structure for server-sent events can simplify event handling logic on the client side, reducing development overhead and potential errors. It also lays a foundation for easier expansion and incorporation of new event types in the future, enhancing the project's adaptability and growth potential.
Acknowledgements
The text was updated successfully, but these errors were encountered: