ws

package
v0.3.37 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WsServer

type WsServer struct {
	lokas.Server
	Context *lokas.Context
	// contains filtered or unexported fields
}

func NewWsServer

func NewWsServer(context *lokas.Context) *WsServer

NewWsServer create a new websocket server

func (*WsServer) Broadcast

func (this *WsServer) Broadcast(sessionIds []util.ID, data []byte)

Broadcast broadcast data to all active connections

func (*WsServer) GetActiveConnNum

func (this *WsServer) GetActiveConnNum() int

GetActiveConnNum get count of active connections

func (*WsServer) ServeHTTP

func (this *WsServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serve http request

func (*WsServer) Start

func (this *WsServer) Start(addr string) error

Start websocket server, and start default http server if addr is not empty

func (*WsServer) Stop

func (this *WsServer) Stop()

Stop websocket server, and the underline default http server

Jump to

Keyboard shortcuts

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