From f659d6ce48e0c77f785a813faf1585d8f0b216ec Mon Sep 17 00:00:00 2001 From: sor4chi Date: Thu, 30 Nov 2023 23:22:34 +0900 Subject: [PATCH] chore: changeset --- .changeset/three-actors-develop.md | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .changeset/three-actors-develop.md diff --git a/.changeset/three-actors-develop.md b/.changeset/three-actors-develop.md new file mode 100644 index 00000000..e0c95f7a --- /dev/null +++ b/.changeset/three-actors-develop.md @@ -0,0 +1,36 @@ +--- +"hono-do": minor +--- + +Support for three handlers about [Hibernation Websocket API](https://developers.cloudflare.com/durable-objects/learning/websockets/#websocket-hibernation). + +- `webSocketMessage` handler +- `webSocketClose` handler +- `webSocketError` handler + +You can use these handlers same way as `alarm` handler in Hono DO. + +## Usage + +### Flat way + +```ts +const DO = generateHonoObject("/", () => {}); +DO.alarm(async () => {}); +DO.webSocketMessage(async () => {}); +DO.webSocketClose(async () => {}); +DO.webSocketError(async () => {}); +``` + +### Chaining way + +```ts +generateHonoObject("/", () => {}) + .alarm(async () => {}) + .webSocketMessage(async () => {}) + .webSocketClose(async () => {}) + .webSocketError(async () => {}); +``` + +Take care for registering multiple handlers for same event. +If you register so, you will get an error.