Skip to content

The caller should be able to override the id value #738

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

Closed
t33x opened this issue Jul 21, 2022 · 0 comments · Fixed by #2077
Closed

The caller should be able to override the id value #738

t33x opened this issue Jul 21, 2022 · 0 comments · Fixed by #2077
Labels
package:json_rpc_2 type-enhancement A request for a change that isn't a bug

Comments

@t33x
Copy link

t33x commented Jul 21, 2022

The JSON-RPC transport agnostic. The current implementation uses an auto-increment number (which always starts from zero) as the id value. This is appropriate for a point-to-point type transport (e.g. socket based protocols), but for MQTT, for example, this could potentially cause problems when the server replies are received by all clients, and clients start sending requests at the same time but with different parameters (but with same id started from zero). JSON-RPC states that the id can be of string type. If clients were able to choose a unique string value specific to them as the id value, it could be safely used with MQTT in all cases.

@devoncarew devoncarew added the type-enhancement A request for a change that isn't a bug label Feb 12, 2023
@mosuem mosuem transferred this issue from dart-archive/json_rpc_2 Oct 28, 2024
jakemac53 added a commit that referenced this issue Apr 21, 2025
This is to support using this package to write a dart analyzer LSP client, which requires String ids.

Also closes #738

This is technically breaking because there was some code which tries to coerce string ids back into integers, but this should never have happened. Any server stringifying integer IDs is not spec compliant.

Let me know if we want to release this as non-breaking instead of breaking, I think it would be fine personally, but don't feel strongly either way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:json_rpc_2 type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants