gpwebsocket

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initiate

func Initiate(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error)

func Periodic

func Periodic(w http.ResponseWriter, r *http.Request, interval time.Duration, do func(conn *websocket.Conn) error)

func WriteText

func WriteText(r *http.Request, conn *websocket.Conn, msg string) bool

WriteText writes a text message to the websocket connection. It returns true if the message was written successfully, false otherwise. It logs an error if the message is not written successfully.

Types

type Writer

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

func NewWriter

func NewWriter(ctx context.Context, conn *websocket.Conn, msgType websocket.MessageType) *Writer

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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