websocket

package
v0.0.0-...-730ab85 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPack

type DataPack struct{}

func (*DataPack) GetHeadLen

func (dp *DataPack) GetHeadLen() uint32

func (*DataPack) Pack

func (dp *DataPack) Pack(m *common.Message) ([]byte, error)

func (*DataPack) Unpack

func (dp *DataPack) Unpack(binaryData []byte) (*common.Message, error)

type Msg

type Msg struct {
	Id   byte
	Data string
	Len  int64
}

type Server

type Server struct {
	ConnMgr     *common.ConnManager
	OnConnStart func(conn *common.Connection)
	OnConnStop  func(conn *common.Connection)
	// contains filtered or unexported fields
}

func NewWebsocket

func NewWebsocket() *Server

func (*Server) AddRouter

func (s *Server) AddRouter(msgId byte, router common.IRouter)

func (*Server) GetConnMgr

func (s *Server) GetConnMgr() *common.ConnManager

func (*Server) ServeWebSocket

func (s *Server) ServeWebSocket(w http.ResponseWriter, req *http.Request)

func (*Server) SetOnConnStart

func (s *Server) SetOnConnStart(hookFunc func(*common.Connection))

func (*Server) SetOnConnStop

func (s *Server) SetOnConnStop(hookFunc func(*common.Connection))

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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