Skip to content
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

Implement ping-pong for WebSocket server #782

Merged
merged 8 commits into from
May 27, 2022
Merged

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented May 24, 2022

This PR exposes the ping-pong interface of the WebSocket server.

This is the counterpart of the client #772, requested by #738 .

Testing Done

  • modified examples/ws into two binaries, one for the server, one for the client; started them with trace logs
2022-05-27T10:24:20.552095Z DEBUG jsonrpsee_ws_server::server: send ping
2022-05-27T10:24:20.552336Z TRACE soketto::connection: bd133ba0: send: (Ping (fin 1) (rsv 000) (mask (0 0)) (len 0))
2022-05-27T10:24:20.552676Z TRACE soketto::connection: bd133ba0: Sender flushing connection
2022-05-27T10:24:20.556269Z TRACE soketto: read 2 bytes
2022-05-27T10:24:20.556340Z TRACE soketto: read 4 bytes
2022-05-27T10:24:20.556374Z TRACE soketto::connection: bd133ba0: recv: (Pong (fin 1) (rsv 000) (mask (1 fba99e45)) (len 0))
2022-05-27T10:24:20.556414Z DEBUG jsonrpsee_ws_server::server: recv pong

lexnv added 2 commits May 24, 2022 18:35
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv requested a review from a team as a code owner May 24, 2022 18:38
@lexnv lexnv changed the title Implement ping-pong for WebSocket server Implement ping-pongfor WebSocket server May 24, 2022
@lexnv lexnv changed the title Implement ping-pongfor WebSocket server Implement ping-pong for WebSocket server May 24, 2022
ws-server/src/server.rs Outdated Show resolved Hide resolved
ws-server/src/server.rs Outdated Show resolved Hide resolved
ws-server/src/server.rs Outdated Show resolved Hide resolved
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv self-assigned this May 25, 2022
ws-server/src/server.rs Outdated Show resolved Hide resolved
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
ws-server/src/server.rs Outdated Show resolved Hide resolved
Copy link
Member

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but would be good if you could replace the select!

lexnv added 3 commits May 26, 2022 13:32
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv
Copy link
Contributor Author

lexnv commented May 27, 2022

To have symmetry with the client implementation, added the following debug logs for Ping / Pong frames:

2022-05-27T10:24:20.552095Z DEBUG jsonrpsee_ws_server::server: send ping
...
2022-05-27T10:24:20.556414Z DEBUG jsonrpsee_ws_server::server: recv pong

ws-server/src/server.rs Outdated Show resolved Hide resolved
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv requested a review from jsdw May 27, 2022 12:12
Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@niklasad1 niklasad1 merged commit 9fe25b1 into master May 27, 2022
@niklasad1 niklasad1 deleted the 738_ping_pong_server branch May 27, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants