ws

package
v0.0.0-...-aed9a31 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextMessage   = websocket.TextMessage
	BinaryMessage = websocket.BinaryMessage
)

Variables

This section is empty.

Functions

func NewServer

func NewServer(serverID string, opts ...ServerOption) inet.SocketServer

Types

type CheckOriginFunc

type CheckOriginFunc func(r *http.Request) bool

type ServerOption

type ServerOption func(o *serverOptions)

func WithServerCheckOrigin

func WithServerCheckOrigin(checkOrigin CheckOriginFunc) ServerOption

WithServerCheckOrigin 设置Websocket跨域检测函数

func WithServerCredentials

func WithServerCredentials(certFile, keyFile string) ServerOption

WithServerCredentials 设置证书和秘钥

func WithServerEnableHeartbeatCheck

func WithServerEnableHeartbeatCheck(enable bool) ServerOption

WithServerEnableHeartbeatCheck 是否启用心跳检测

func WithServerHandshakeTimeout

func WithServerHandshakeTimeout(handshakeTimeout time.Duration) ServerOption

WithServerHandshakeTimeout 设置握手超时时间

func WithServerHeartbeatCheckInterval

func WithServerHeartbeatCheckInterval(heartbeatCheckInterval time.Duration) ServerOption

WithServerHeartbeatCheckInterval 设置心跳检测间隔时间

func WithServerListenAddr

func WithServerListenAddr(addr string) ServerOption

WithServerListenAddr 设置监听地址

func WithServerMaxConnNum

func WithServerMaxConnNum(maxConnNum int) ServerOption

WithServerMaxConnNum 设置连接的最大连接数

func WithServerMaxMsgLen

func WithServerMaxMsgLen(maxMsgLen int) ServerOption

WithServerMaxMsgLen 设置最大包体长度

func WithServerPath

func WithServerPath(path string) ServerOption

WithServerPath 设置Websocket的连接路径

Jump to

Keyboard shortcuts

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