endpoint

package
v0.0.0-...-7e69858 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

* @Author: your name * @Date: 2021-10-19 17:41:17 * @LastEditTime: 2021-11-04 17:05:48 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /components/gxynet/conn/endpoint.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEventHandler

type BaseEventHandler struct {
}

func (*BaseEventHandler) OnClose

func (*BaseEventHandler) OnError

func (*BaseEventHandler) OnMessage

func (*BaseEventHandler) OnOpen

func (e *BaseEventHandler) OnOpen(ctx context.Context, _ Endpoint) error

type CoreBundle

type CoreBundle struct {
	*processor.Processor
	Handler EventHandler
}

func (*CoreBundle) BindHandler

func (p *CoreBundle) BindHandler(handler EventHandler)

func (*CoreBundle) BindProc

func (p *CoreBundle) BindProc(c *gxyconfig.Configuration) error

type Endpoint

type Endpoint interface {
	Send(msg interface{}) error
	Start(ctx context.Context) error
	Close(context.Context, error)
	Conn() net.Conn
	GetData() interface{}
	SetData(interface{})
}

type EventHandler

type EventHandler interface {
	OnOpen(context.Context, Endpoint) error
	OnClose(context.Context, Endpoint)
	OnError(context.Context, Endpoint, error)
	OnMessage(context.Context, Endpoint, *message.Message) error
}

type TcpEndpoint

type TcpEndpoint struct {
	CoreBundle
	// contains filtered or unexported fields
}

func NewTcpEndPoint

func NewTcpEndPoint(conn net.Conn, bundle CoreBundle) *TcpEndpoint

func (*TcpEndpoint) Close

func (t *TcpEndpoint) Close(ctx context.Context, err error)

func (*TcpEndpoint) Conn

func (t *TcpEndpoint) Conn() net.Conn

func (*TcpEndpoint) GetData

func (t *TcpEndpoint) GetData() interface{}

func (*TcpEndpoint) IsClosed

func (t *TcpEndpoint) IsClosed() bool

func (*TcpEndpoint) Send

func (t *TcpEndpoint) Send(msg interface{}) error

func (*TcpEndpoint) SetData

func (t *TcpEndpoint) SetData(d interface{})

func (*TcpEndpoint) Start

func (t *TcpEndpoint) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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