websocket

package
v0.9.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package websocket implements a protocol.Protocol driver for WebSocket.

Unlike the HTTP and gRPC drivers, a WebSocket connection is not request paced — once open, either side can send at any time, independent of the other. Phase 0 keeps this driver to the simplest useful shape: each call to Do opens its own connection, optionally sends one message, and (if it sent one) waits for exactly one reply before closing — a handshake-and-echo probe, not a persistent streaming session. A scenario that needs a long-lived connection shared across many messages is out of scope here; see AGENTS.md's Phase 0 non-goals.

Index

Constants

This section is empty.

Variables

Options are the -opt keys this driver accepts.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver is a WebSocket protocol.Protocol.

func New

func New(target protocol.Target, timeout time.Duration) (*Driver, error)

New returns a ready-to-use Driver for target. target.URL must be a ws:// or wss:// URL. timeout bounds the handshake and, if a message is sent, the wait for its reply.

New returns an error only for a configuration problem — an unparseable URL or a scheme other than ws/wss — never for the target being unreachable, which Do reports per call instead.

func (*Driver) Close

func (d *Driver) Close() error

Close implements protocol.Protocol. Do opens and closes its own connection every call, so Driver itself holds nothing to release.

func (*Driver) Do

func (d *Driver) Do(ctx context.Context) (protocol.Result, error)

Do implements protocol.Protocol.

func (*Driver) Name

func (d *Driver) Name() string

Name implements protocol.Protocol.

Jump to

Keyboard shortcuts

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