websocketutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package websocketutil contains methods for interacting with websocket connections.

Index

Constants

This section is empty.

Variables

View Source
var ErrNil = errors.New("websocket is nil")

ErrNil is returned when the websocket connection is nil.

Functions

This section is empty.

Types

type IWebsocketUtil

type IWebsocketUtil interface {
	OpenConnection(url string) (*websocket.Conn, error)
	CloseConnection(ws websocket.Conn) error
}

IWebsocketUtil is the interface for the websocketutil.

type WebsocketUtil

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

WebsocketUtil struct provides functionality around creating and maintaining websockets.

func NewWebsocketUtil

func NewWebsocketUtil(logger log.T, dialerInput *websocket.Dialer) *WebsocketUtil

NewWebsocketUtil is the factory function for websocketutil.

func (*WebsocketUtil) CloseConnection

func (u *WebsocketUtil) CloseConnection(ws *websocket.Conn) error

CloseConnection closes a websocket connection given the Conn object as input.

func (*WebsocketUtil) OpenConnection

func (u *WebsocketUtil) OpenConnection(url string) (*websocket.Conn, error)

OpenConnection opens a websocket connection provided an input url.

Jump to

Keyboard shortcuts

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