websocket

command
v1.27.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

websocket example — chat-style echo server.

go run ./examples/websocket
wscat -c ws://localhost:8080/ws

Untyped on purpose — the request never completes

An upgrade hands the connection to another protocol: there is no response body for a typed op's Out to be, and the exchange that follows is frames in both directions for as long as the peer stays. A typed op is one decode, one call, one serialize, so it cannot express this — which is why wsx.Upgrade takes an untyped handler and not a TypedHandler.

The cost is the same one every untyped route pays: no OpenAPI entry, no MCP tool, not reachable by zip.Call. Anything with a request-and-response shape belongs in a typed op instead — see examples/hello.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL