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

Change/Remove ClientWebSocket ping packet body #110158

Open
zxcvqwerasdf opened this issue Nov 25, 2024 · 6 comments
Open

Change/Remove ClientWebSocket ping packet body #110158

zxcvqwerasdf opened this issue Nov 25, 2024 · 6 comments
Labels
area-System.Net needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity untriaged New issue has not been triaged by the area owner

Comments

@zxcvqwerasdf
Copy link

As i know, there is no way send ping's with ClientWebSocket directly, only by using

_webSocket.Options.KeepAliveInterval

But it's sends integer in body
Image
Can you add feature to do not send ping packet body? Only ping opcode?
Thank you.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 25, 2024
@MihaZupan
Copy link
Member

MihaZupan commented Nov 25, 2024

Why do you care whether the extra bytes are sent / what's the motivation to avoid it?

@MihaZupan MihaZupan added the needs-author-action An issue or pull request that requires more info or actions from the author. label Nov 25, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Nov 25, 2024
@zxcvqwerasdf zxcvqwerasdf reopened this Nov 25, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 25, 2024
@zxcvqwerasdf
Copy link
Author

zxcvqwerasdf commented Nov 25, 2024

Why do you care whether the extra bytes are sent / what's the motivation to avoid it?

I am using custom ping/pong on the server and i need custom data in ping message

@dotnet-policy-service dotnet-policy-service bot removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Nov 25, 2024
@CarnaViire
Copy link
Member

custom ping/pong on the server

// TL;DR: Custom Ping/Pong on the server could only apply to server's Pings, it is fully independent from what the client sends in the client's Pings.

@zxcvqwerasdf
Ping/Pongs initiated from the client side and from the server side are two separate things.

By RFC, the receiver of a Ping frame MUST echo back the data in the Pong response:

   A Pong frame sent in response to a Ping frame must have identical
   "Application data" as found in the message body of the Ping frame
   being replied to.

What that means:

  1. If Ping/Pongs are initiated from the client side:

    • the server must echo the data back, and there could be nothing custom about it. Imagine your server will also have another client that is not on .NET -- this client would be free to send whatever (fitting the RFC requirements), and the server must comply.
  2. If Ping/Pongs are initiated from the server side:

    • it only matters what ClientWebSocket responds in the Pong frame. And it will, as well, echo back whatever custom data the server sent in the server's Ping.

@CarnaViire CarnaViire added the needs-author-action An issue or pull request that requires more info or actions from the author. label Nov 26, 2024
Copy link
Contributor

This issue has been marked needs-author-action and may be missing some important information.

@MihaZupan
Copy link
Member

custom data in ping message

What sort of information would you want to transmit?
What's the motivation behind using pings instead of regular messages? Note that the size of ping data is very limited whereas regular messages can be arbitrarily large.

Copy link
Contributor

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants