socket

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnInfo

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

ConnInfo ...

func (*ConnInfo) Close

func (ci *ConnInfo) Close()

Close ...

func (*ConnInfo) Listen

func (ci *ConnInfo) Listen()

Listen ...

func (*ConnInfo) Send

func (ci *ConnInfo) Send(mtype int, msg []byte) error

Send ...

type Message

type Message struct {
	MessageType   int
	Message       []byte
	SocketConnKey string
}

Message game service call back handle on socket read,

type Service

type Service struct {
	*websocket.Upgrader
	ConnMap map[string]*ConnInfo
}

Service ...

func NewSocket

func NewSocket() *Service

NewSocket ...

func (*Service) AddNewConn

func (s *Service) AddNewConn(mapKey string, newConn *websocket.Conn, readFunc func(Message) error)

AddNewConn ...

func (*Service) CloseConn

func (s *Service) CloseConn(mapKey string)

CloseConn ...

func (*Service) HTTPLisentRun

func (s *Service) HTTPLisentRun(adders string, HandleURL ...[]Setting) (err error)

HTTPLisentRun ...

type Setting

type Setting struct {
	RequestType string
	URL         string
	Fun         func(http.ResponseWriter, *http.Request)
	ConnType    string
}

Setting ...

Jump to

Keyboard shortcuts

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