Help us shape the future of Go! Take the 2026 Go Developer Survey

websocket

command
v1.37.42 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 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