Are the user messages charged in setWebSocketAutoResponse?

I am trying to implement a cheap and predictable-cost ping/pong system in my Durable Object Websocket to allow client check server connection is alive. https://developers.cloudflare.com/durable-objects/platform/pricing/#compute-billing
"3 Application level auto-response messages handled by state.setWebSocketAutoResponse() will not incur additional wall-clock time, and so they will not be charged."
Great, but what about the user/client-side request messages?
"There is no charge for outgoing WebSocket messages, nor for incoming WebSocket protocol pingshttps://www.rfc-editor.org/rfc/rfc6455#section-5.5.2"
However we can't manually call the standard ping with the opcode of 0x9 in browsers. And, in my tests, chrome-based browsers also does not auto ping websocket connections. So the only alternative is to create a custom ping-pong with the state.setWebSocketAutoResponse() API, as mentioned here https://developers.cloudflare.com/durable-objects/api/state/#setwebsocketautoresponse
setWebSocketAutoResponse is a common alternative to setting up a server for static ping/pong messages because this can be handled without waking hibernating WebSockets.
But it's not clear if the user PING messages will be charged since it can't follow the standard opcode - So I am using a simple 'ping' message payload. If the user PING messages are charged, we cannot have a granular control of this, the user can theoretically send unlimited messages and it will be charged.
1 Reply
Kaique Anarkrypto
Hi, @Walshy | Workers/Pages! Do you know where is the best place to ask this?

Did you find this page helpful?