Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidCodec = errors.New("invalid codec callback") ErrInvalidOnMessage = errors.New("invalid on message callback") )
Functions ¶
Types ¶
type Codec ¶
Codec is the interface for message coder and decoder. Application programmer can define a custom codec themselves.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a client connection to a TCP server.
type Logger ¶
type Logger interface { Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) }
Logger is our contract for the logger
type Option ¶
type Option func(*options)
Option sets server options.
func BufferSizeOption ¶
HeartbeatOption returns a Option that is the size of buffered channel, for example an indicator of defaultBufferSize32 means a size of 256.
func CustomCodecOption ¶
CustomCodecOption returns a Option that will apply a custom Codec.
func HeartbeatOption ¶
HeartbeatOption returns a Option that is the size of buffered channel, for example an indicator of defaultBufferSize32 means a size of 256.
func MessageMaxSize ¶
MessageMaxSize returns a Option that will set buffer to receive message when new []byte arrived.
func OnErrorOption ¶
OnErrorOption returns a Option that will set callback to call when error occurs.
func OnMessageOption ¶
OnMessageOption returns a Option that will set callback to call when new message arrived.