Documentation ¶
Overview ¶
inspired by dubbogo/remoting/getty
inspired by dubbogo/remoting/getty
Index ¶
- Constants
- type PackageHandler
- type ServerHandler
- func (h *ServerHandler) OnClose(session getty.Session)
- func (h *ServerHandler) OnCron(session getty.Session)
- func (h *ServerHandler) OnError(session getty.Session, err error)
- func (h *ServerHandler) OnMessage(session getty.Session, pkg interface{})
- func (h *ServerHandler) OnOpen(session getty.Session) error
- type TcpListenerService
Constants ¶
View Source
const ( // WritePkg_Timeout the timeout of write pkg WritePkg_Timeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageHandler ¶
type PackageHandler struct {
// contains filtered or unexported fields
}
func NewPackageHandler ¶
func NewPackageHandler(ls *TcpListenerService) *PackageHandler
func (*PackageHandler) Read ¶
func (h *PackageHandler) Read(ss getty.Session, data []byte) (interface{}, int, error)
func (*PackageHandler) Write ¶
func (h *PackageHandler) Write(ss getty.Session, p interface{}) ([]byte, error)
type ServerHandler ¶
type ServerHandler struct {
// contains filtered or unexported fields
}
ServerHandler package handler
func NewServerPackageHandler ¶
func NewServerPackageHandler(ls *TcpListenerService) *ServerHandler
NewServerPackageHandler create serverHandler
func (*ServerHandler) OnClose ¶
func (h *ServerHandler) OnClose(session getty.Session)
OnError called when session close
func (*ServerHandler) OnError ¶
func (h *ServerHandler) OnError(session getty.Session, err error)
OnError called when err
func (*ServerHandler) OnMessage ¶
func (h *ServerHandler) OnMessage(session getty.Session, pkg interface{})
OnMessage called when session receive new pkg
type TcpListenerService ¶
type TcpListenerService struct { listener.BaseListenerService // contains filtered or unexported fields }
ListenerService the facade of a listener
func (*TcpListenerService) Close ¶
func (ls *TcpListenerService) Close() error
func (*TcpListenerService) ShutDown ¶
func (ls *TcpListenerService) ShutDown(wg interface{}) error
func (*TcpListenerService) Start ¶
func (ls *TcpListenerService) Start() error
Start start tcp server
Click to show internal directories.
Click to hide internal directories.