network

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller interface {
	Call(ctx context.Context, uri interface{}, rq, rs interface{}, opts *rpc.CallOptions) (err error)
	AsyncCall(ctx context.Context, uri interface{}, rq interface{}, af process.RouterFunc, opts *rpc.AsyncCallOptions) (err error)
	Notify(ctx context.Context, uri interface{}, rq interface{}, opts *rpc.NoticeOptions) (err error)
}

type CallerResponser

type CallerResponser interface {
	Write(ctx context.Context, payload interface{}, md metadata.MD)
}

type Client

type Client interface {
	Link

	AddCloseClientFunc(f func(sess Client))
}

type ClientContext

type ClientContext interface {
	process.Context
	Link
}
type Link interface {
	// network write or close
	io.WriteCloser
	//
	Caller
}

type Server

type Server interface {
	Broadcast(uri interface{}, msg interface{}, md metadata.MD) error
	BroadcastFilter(filter func(Session) bool, uri interface{}, msg interface{}, md metadata.MD) error
	ForEach(f func(Session))
}

type Session

type Session interface {
	Link
	// GetConn get raw conn(net.Conn,websocket.Conn...)
	GetConn() interface{}
	// GetServer get raw server(*WsServer,*TcpServer...)
	GetServer() Server

	// WithSessionValue wrap context.WithValue
	WithSessionValue(key, value interface{})

	// SessionValue wrap context.Context.Value
	SessionValue(key interface{}) interface{}
	// AddCloseSessionFunc session close notify
	AddCloseSessionFunc(f func(sess Session))
}

type SessionContext

type SessionContext interface {
	Session
	process.Context
}

type WriteMethod

type WriteMethod int8
const (
	WriteAsync WriteMethod = iota
	WriteImmediately
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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