caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
56.44k stars 3.96k forks source link

how to get websocket data size on caddy v2 #3432

Closed sy2un closed 4 years ago

sy2un commented 4 years ago

I'm developing a cdn service based on caddy2, and proxy websocket request, i want to count websocket data size, but i don't know how to get websocket data, Has anyone ever done this before? i need some suggestion, thank you

caddy version:v2

francislavoie commented 4 years ago

Hi! Thanks for trying Caddy!

I don't think this is currently possible, but it should be soon with the TCP transport plugin!

https://twitter.com/mholt6/status/1261007112647270401?s=19

mholt commented 4 years ago

If you want to count the number of bytes transmitted, you need to get beneath the HTTP layer. As Francis suggested, this Caddy app should do the trick: https://github.com/mholt/conncept