[ws-server] Batch support#300
Conversation
Add a draft batch request test
Cleanup Use CallError
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
| Ok(res) => send_response(id, tx, res), | ||
| Err(InvalidParams) => send_error(id, tx, JsonRpcErrorCode::InvalidParams.into()), | ||
| // TODO: this looks wonky... | ||
| Err(CallError::InvalidParams(InvalidParams)) => { |
There was a problem hiding this comment.
I think we can remove this InvalidParams type and just use to InvalidParams variant,
perhaps link to #299
There was a problem hiding this comment.
thus, if CallError would implement a trait or something JsonRpcErrorCode then you could just to err.to_error_code() or something similar
There was a problem hiding this comment.
Looks overall good, not exactly sure of the overhead w.r.t spawning an unbounded channel per batch request.
Should be faster than reusing the existing channel and we "will" limit incoming requests based on payload size anyway so should be fine w.r.t OOM/DOS related issues.
|
An additional bonus to this PR, would be to add integration tests for batch requests (both HTTP and WS) Could address it in another PR also. |
Return app-level error when call fails
Co-authored-by: Andrew Plaza <aplaza@liquidthink.net>
Co-authored-by: Andrew Plaza <aplaza@liquidthink.net>
Add batch request support for the websocket server. Continuation of #292.
Closes #277
TODO:
InvalidParamstoCallError::Failed