websocket

package
v0.0.0-...-e31b469 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WSCallRoute

type WSCallRoute func(funcID string, param *WSMessage) *WSReturn

WSCallRoute is

type WSMessage

type WSMessage struct {
	MessageType int
	Data        []byte
}

type WSReturn

type WSReturn struct {
	HasReturn bool
	Data      *WSMessage
}

func NoReturn

func NoReturn() *WSReturn

func Return

func Return(msg *WSMessage) *WSReturn

type WSService

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

func InitWebSocket

func InitWebSocket(heartbeatInterval int, callRoute WSCallRoute) *WSService

func (*WSService) CloseSocket

func (service *WSService) CloseSocket(wsID string)

func (*WSService) Handler

func (service *WSService) Handler(w http.ResponseWriter, r *http.Request, wsID string)

func (*WSService) WriteMsg

func (service *WSService) WriteMsg(wsID string, messageType int, data []byte)

Jump to

Keyboard shortcuts

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