Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { Close() error SetReadDeadline(time.Time) error ReadMessage() (int, []byte, error) WriteMessage(int, []byte) error }
Conn is the interface for a *websocket.Conn as used in this wrapper package
type Dialer ¶
Dialer is the interface for a *websocket.Dialer as used in this wrapper package
func WrapDialer ¶
WrapDialer will wrap a *websocket.Dialer so it conforms to this package's interface
type MessageHandler ¶
MessageHandler is the api of an object that has a HandleRequest MessageHandlerFunc method
func NewMessageHandler ¶
func NewMessageHandler(h MessageHandlerFunc) MessageHandler
NewMessageHandler creates a MessageHandler from the given MessageHandlerFunc
type MessageHandlerFunc ¶
MessageHandlerFunc is the api of a handler that processes a WSMessage and sends a response back over the response channe;
type MessageType ¶
type MessageType int
MessageType represents the type of data being sent or received over a websocket connection
const ( Text MessageType = 1 Binary = 2 )
Websocket Message types
func (MessageType) String ¶
func (t MessageType) String() string
type WSClient ¶
type WSClient interface { SetGateway(string) SetHandler(MessageHandler) Connect(string) error Close() HandleRequests(context.Context) error SendMessage(msg WSMessage) }
WSClient is the api for a client that maintains an active websocket connection and hands off messages to be processed.
func NewWSClient ¶
NewWSClient creates a new WSClient