Skip to content
Discussion options

You must be logged in to vote

YARP treats a WebSocket connection as an opaque data stream - we don't try to parse/reencode messages (except for telemetry purposes). But you can still count the total number of bytes.
You can look at the WebSocketTelemetry middleware for inspiration as to how you can intercept the WebSocket stream.

https://gist.github.com/MihaZupan/a5b0e514337b1ceb74fe03f97e3183ad is an example of how you may limit the size of a WebSocket connection and abort it if it exceeds a given size. Note that this will just close the transport connection, it won't be a graceful WebSocket close for the client.

If that is not acceptable for your clients, you would have to parse the WebSocket traffic and insert a pr…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@RichardSunMS
Comment options

Comment options

You must be logged in to vote
1 reply
@RichardSunMS
Comment options

Answer selected by RichardSunMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants