-
-
Notifications
You must be signed in to change notification settings - Fork 902
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 support for correlation ids to websocket messages #993
Comments
@dessalines if this seems reasonable, i'd love to take it on for a chance to dig in to rust :) |
You could, although I'm not exactly sure what purpose it would serve. The back-end already has the concept of
What matters most for websocket, is making sure that user has joined / left the correct contexts, and receiving the right messages it should for those contexts. How would correlation ids help me make sure, for example, if I'm in a post room, that I'm receiving all the correct |
@eiknat Do you still think this is needed, or can we close the issue? |
I did add the optional |
Okay then I'm closing this. |
I think this would be very useful. I think it should be in the websocket message itself, not the form data, and should apply to all requests, not just some of them. The reason it would be useful is that currently, all requests must be done synchronously, as in you must wait for a response before sending another request of the same type. The reason for this is that if you want to read the response and you send multiple requests, you will not be able to tell which response corresponds to which request. Another issue is the fact that the websocket API can send events when things happen. For example, when a comment is created. The lack of IDs necessitates using multiple connections for events and requests. The reason for this is that if I were to create a comment using the same connection as the one used to listen for comments, I wouldn't be able to tell which I think this issue should be re-opened, because currently, the lack of such IDs makes using the WebSocket API for anything complex extremely annoying and requires very error-prone request-specific code (like checking the content of a comment, for example). This is an extremely simple feature that I believe wouldn't be difficult to implement (though I may be wrong), and would reduce the complexity of a lot of client handling code by a huge amount. |
That makes sense. I have some very hacky code in the front end to work around this very problem anyway. |
Websocket is gone |
rationale:
there are two use cases here:
requests
when sending a request, client and servers be able to know exactly what to look for with their expected response. when they send off a request with a specific correlation id, they can wait for the response that also contains that correlation id to then be able to identify the response that correlates to the request they sent.
live updates
these can also really benefit from correlation ids as websockets can get pretty noisy, clients being able to filter out events easily can help keep them stable under periods of heavy load.
additionally, some clients may not want to support live updates, or clients may want to have the option to turn off all live updates, only some live updates, or live updates when they're just coming too quickly for the client to support. we should provide a way allow developers to implement ways to filter out updates they're not currently interested in.
this also enables clients to create a "live" version of certain sort options without additional effort on the API side or allow individual users to turn off live updates completely (assuming a new user setting).
solution:
websocket messages should implement a correlation id in the same manner that AMQP clients are able to do. the correlation id would be added to websocket messages in this manner:
they can easily be made nullable as well for clients who chose not to use them or for backwards compatibility, a client or server that utilizes the correlation id would be looking for a specific correlation id, so nulls wouldn't be an issue for those who implement them.
The text was updated successfully, but these errors were encountered: