websocket

package
v0.0.0-...-9f872dd Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Conn *websocket.Conn

	OnClose func() // 关闭函数回调
	// contains filtered or unexported fields
}

func NewSession

func NewSession(conn *websocket.Conn) *Session

func (*Session) Close

func (s *Session) Close() bool

func (*Session) GetID

func (s *Session) GetID() int64

func (*Session) GetTag

func (s *Session) GetTag() interface{}

func (*Session) IsClosed

func (s *Session) IsClosed() bool

func (*Session) RemoteAddr

func (s *Session) RemoteAddr() string

func (*Session) Reply

func (s *Session) Reply(header *fnet.Message, msg interface{}, status uint8) bool

func (*Session) Request

func (s *Session) Request(msg interface{}, status, serializeType uint8, indexId uint32) bool

func (*Session) SetID

func (s *Session) SetID(id int64)

func (*Session) SetTag

func (s *Session) SetTag(tag interface{})

func (*Session) Start

func (s *Session) Start()

type WSClient

type WSClient struct {
	Address string
	Name    string

	SerializeType fnet.SerializeType
	// contains filtered or unexported fields
}

func NewWSClient

func NewWSClient(name, address string) *WSClient

func (*WSClient) AddCloseHandler

func (w *WSClient) AddCloseHandler(f fnet.OnCloseFunc)

func (*WSClient) AddConnectHandler

func (w *WSClient) AddConnectHandler(f fnet.OnConnectFunc)

func (*WSClient) GetID

func (w *WSClient) GetID() int64

func (*WSClient) IsRunning

func (w *WSClient) IsRunning() bool

func (*WSClient) Reply

func (w *WSClient) Reply(header *fnet.Message, msg interface{}, status uint8) bool

func (*WSClient) Run

func (w *WSClient) Run()

func (*WSClient) Send

func (w *WSClient) Send(msg interface{}, status uint8) bool

func (*WSClient) SetRunning

func (w *WSClient) SetRunning(v bool)

func (*WSClient) Stop

func (w *WSClient) Stop()

type WSServer

type WSServer struct {
	MaxConn int
	// contains filtered or unexported fields
}

func NewDefaultServer

func NewDefaultServer(addr string) *WSServer

func NewServer

func NewServer(addr string, maxcon int) *WSServer

func (*WSServer) AddCloseHandler

func (ws *WSServer) AddCloseHandler(f fnet.OnCloseFunc)

func (*WSServer) AddConnectHandler

func (ws *WSServer) AddConnectHandler(f fnet.OnConnectFunc)

func (*WSServer) Run

func (ws *WSServer) Run()

Run run with signal handle

func (*WSServer) SetBeforeExit

func (ws *WSServer) SetBeforeExit(f func())

func (*WSServer) SetReload

func (ws *WSServer) SetReload(f func())

func (*WSServer) Start

func (ws *WSServer) Start()

func (*WSServer) Stop

func (ws *WSServer) Stop()

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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