server

package module
v0.0.0-...-10099ad Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Overview

Package server provides the WebSocket server implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WsServer

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

WsServer is a WebSocket server that handles WebSocket connections. It contains a processMessage field which is a slice of functions to process incoming WebSocket messages.

func New

func New(processMessage ...func(conn *websocket.Conn, message []byte)) *WsServer

New creates a new WsServer instance with the provided message processing functions. The processMessage functions will be called to handle each incoming WebSocket message.

func (*WsServer) HandleWebSocket

func (s *WsServer) HandleWebSocket(w http.ResponseWriter, r *http.Request)

HandleWebSocket handles websocket requests by upgrading the HTTP connection to a WebSocket connection.

Jump to

Keyboard shortcuts

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