modulepackage
0.0.0-20240704231131-6e004de633ad
Repository: https://github.com/protolambda/websocket.git
Documentation: pkg.go.dev
# README
websocket
Opinionated wrapper around Gorilla Websocket that:
- Provides
Connection
for client and server that automatically:- Handles ping/pong, and resets ping schedule on read/write as necessary.
- Handles close messages, and closes the connection.
- Makes awaiting a connection-closure easy with a context, and close-reason with context-cause.
- Provides a
Server[E]
that maintains the set of active connections and their metadata (generic for customization). - Provides a
Dial
function to get a connection to an endpoint as client. - Provides a
Client
that handles reconnects. - Provides Go typing for websocket message-types.
- Provides a
Messenger
interface for common client/connection message handling (read/write/close).
License
MIT, see LICENSE
file.
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
BinaryMessage denotes a binary data message.
CloseMessage denotes a close control message.
PingMessage denotes a ping control message.
PongMessage denotes a pong control message.
TextMessage denotes a text data message.
# Variables
No description provided by the author
No description provided by the author
# Structs
Client lazily connects to the configured endpoint on writes/reads when necessary, until the reconnecting-client is Close-ed.
Connection is an opinionated wrapper around the Gorilla websocket connection library.
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
MessageType is a type-safe enum, replacing the message-types by the underlying gorilla-websocket library.
No description provided by the author
No description provided by the author
No description provided by the author