how to use Hibernatable WebSockets API?

Is there any example to show how to use Hibernatable WebSockets API? Just use state.acceptWebSocket, not use ws.accept()?
4 Replies
zegevlier
zegevlier11mo ago
Have you looked at these docs yet? https://developers.cloudflare.com/durable-objects/api/hibernatable-websockets-api/ I really thought there was a better example, but for now you can have a look at https://github.com/cloudflare/workers-chat-demo/tree/hibernation
zane
zane11mo ago
I don’t think it is a demo of using Hibernatable web socket
zegevlier
zegevlier11mo ago
I don't know what you mean, that absolutely uses the hibernation API. The main branch in that repo doesn't, but the branch I linked does.
zane
zane11mo ago
The branch is right.very helpful.thank you!