Download src/gateway/server/close-reason.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 525 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/gateway/server/close-reason.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/gateway/server/close-reason.ts
-
curl -L -o close-reason.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/gateway/server/close-reason.ts
525 Bytes
| // Close reason helpers keep WebSocket handshake failure text within RFC byte limits. | |
| import { truncateUtf8Prefix } from "../../utils/utf8-truncate.js"; | |
| /** | |
| * WebSocket close reason utilities. | |
| */ | |
| const CLOSE_REASON_MAX_BYTES = 120; | |
| /** Truncates close reasons to the RFC-safe byte limit used during handshake failures. */ | |
| export function truncateCloseReason(reason: string, maxBytes = CLOSE_REASON_MAX_BYTES): string { | |
| if (!reason) { | |
| return "invalid handshake"; | |
| } | |
| return truncateUtf8Prefix(reason, maxBytes); | |
| } | |