Skip to content

Conversation

@lucifer4j
Copy link

@lucifer4j lucifer4j commented Sep 4, 2022

This PR covers a lot of stuff.

  • Add Websockets and HTTP transports in addition to the existing TCP transport for the JSON RPC bridge.
  • The Websockets transport can be configured to send messages in text or binary.
  • A basic JSON schema is included in the resources and loaded from classpath at runtime to validate the messages received on the bridge.
  • Add separate tests for each transport.
  • Message Type Support
    • Websockets and TCP support all message types.
    • The HTTP transport does not support publish/send from server to client and unregister method.
    • HTTP transport supports SSE.
  • HTTP transport has a convenience method to access SSE because SSE doesn't allow POST or request body.
  • Adds demos for all transports.
  • Lots of refactorings around writing the message, see commits for more details.

pmlopes and others added 30 commits June 2, 2022 10:05
The parser in the test assumes that it will get only 1 message i.e the
message of the pong. However actually, the register request's response
is also received by it. Since register is tested elsewhere and not needed
to test ping, do not register in this test.

Signed-off-by: Lucifer Morningstar <[email protected]>
The parser in the test assumes that it will get only 1 message i.e the
message of the pong. However actually, three messages will arrive. 1 ACK
for register, 1 ACK for publish and finally the message for publish
message itself. Update the test to handle 3 messages.

Signed-off-by: Lucifer Morningstar <[email protected]>
The parser in the test was not handling messages. Add handling for 1 ACK
for register, 1 ACK for publish and 1 ACK for unregister in addition to
publish and send message. The error checking also looks inconsistent/broken
at the moment for now fix by conforming to whatever bridge returns. Reevaluate
after tests are fixed.

Signed-off-by: Lucifer Morningstar <[email protected]>
Fix test assertions like message format for invalid send.

Signed-off-by: Lucifer Morningstar <[email protected]>
The JSON-RPC 2.0 spec mandates value of id in response to be same as
that in the request. The broken test assertion was trying to test
otherwise, hence was wrong.

Signed-off-by: Lucifer Morningstar <[email protected]>
The format of message in JSON-RPC is different from TCP bridge so need
to fix test assertions accordingly.

Signed-off-by: Lucifer Morningstar <[email protected]>
The implementation is looking for a top level failureCode field in the
message which would be right for Vertx protocol but not for the JSON-RPC
implementation. For now, I have changed it to look for an error field
in the params. This may need adjusting as I couldn't find the case of
JSON-RPC client sending back error message to server in the spec.

Signed-off-by: Lucifer Morningstar <[email protected]>
This way we can configure WS connections to send response in text or
binary.
For http request, end handler will always be invoked after the request
data has been read. While for websockets and tcp sockets, it is only
invoked at end of connection. So, it makes sense to have it in the latter
but not in http transport. Also, the actions we took in the end handler
was remove existing subscriptions but that should actually be done
when response has ended. Therefore, added it as bodyHandler to response
instead.
For http request, end handler will always be invoked after the request
data has been read. While for websockets and tcp sockets, it is only
invoked at end of connection. So, it makes sense to have it in the latter
but not in http transport. Also, the actions we took in the end handler
was remove existing subscriptions but that should actually be done
when response has ended. Therefore, added it as bodyHandler to response
instead.
@vietj vietj modified the milestones: 4.5.8, 4.5.9 May 24, 2024
@vietj vietj modified the milestones: 4.5.9, 4.5.10 Jul 17, 2024
@vietj vietj modified the milestones: 4.5.10, 4.5.11 Sep 4, 2024
@vietj vietj modified the milestones: 4.5.11, 4.5.12 Nov 12, 2024
@vietj vietj modified the milestones: 4.5.12, 4.5.13 Jan 23, 2025
@vietj vietj modified the milestones: 4.5.13, 4.5.14 Feb 10, 2025
@vietj vietj modified the milestones: 4.5.14, 4.5.15 Apr 3, 2025
@vietj vietj modified the milestones: 4.5.15, 4.5.16 May 16, 2025
@vietj vietj modified the milestones: 4.5.16, 4.5.17 Jun 19, 2025
@vietj vietj modified the milestones: 4.5.17, 4.5.18 Aug 5, 2025
@vietj vietj modified the milestones: 4.5.18, 4.5.19 Aug 13, 2025
@vietj vietj modified the milestones: 4.5.19, 4.5.20, 4.5.21 Aug 27, 2025
@vietj vietj modified the milestones: 4.5.21, 4.5.22 Sep 3, 2025
@vietj vietj modified the milestones: 4.5.22, 4.5.23 Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants