dummyGateway

package
v0.14.12 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Exposer func(gw *Gateway)
}

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func NewConn added in v0.12.11

func NewConn(onMessage func(connID uint64, streamID int64, data []byte, hdr map[string]string)) *Conn

func (*Conn) Body added in v0.10.0

func (c *Conn) Body() []byte

func (*Conn) ClientIP

func (c *Conn) ClientIP() string

func (*Conn) ConnID

func (c *Conn) ConnID() uint64

func (*Conn) Get

func (c *Conn) Get(key string) interface{}

func (*Conn) Method added in v0.10.0

func (c *Conn) Method() string

func (*Conn) MultiPart added in v0.10.0

func (c *Conn) MultiPart() (*multipart.Form, error)

func (*Conn) Path added in v0.10.0

func (c *Conn) Path() string

func (*Conn) Persistent

func (c *Conn) Persistent() bool

func (*Conn) Redirect added in v0.12.32

func (c *Conn) Redirect(statusCode int, newHostPort string)

func (*Conn) Set

func (c *Conn) Set(key string, val interface{})

func (*Conn) SetPersistent

func (c *Conn) SetPersistent(b bool)

func (*Conn) WriteBinary added in v0.10.0

func (c *Conn) WriteBinary(streamID int64, data []byte) error

func (*Conn) WriteHeader added in v0.10.0

func (c *Conn) WriteHeader(key, value string)

func (*Conn) WriteStatus added in v0.10.5

func (c *Conn) WriteStatus(status int)

type Gateway

type Gateway struct {
	gateway.ConnectHandler
	gateway.MessageHandler
	gateway.CloseHandler
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Gateway, error)

func (*Gateway) Addr

func (g *Gateway) Addr() []string

func (*Gateway) CloseConn

func (g *Gateway) CloseConn(connID uint64)

CloseConn closed the connection

func (*Gateway) GetConn

func (g *Gateway) GetConn(connID uint64) rony.Conn

func (*Gateway) OpenConn

func (g *Gateway) OpenConn(
	connID uint64, persistent bool,
	onReceiveMessage func(connID uint64, streamID int64, data []byte),
	hdr ...*rony.KeyValue,
)

OpenConn opens a persistent connection to the gateway. For short lived use RPC or REST methods.

func (*Gateway) Protocol added in v0.7.2

func (g *Gateway) Protocol() rony.GatewayProtocol

func (*Gateway) REST added in v0.10.0

func (g *Gateway) REST(connID uint64, method, path string, body []byte, kvs ...*rony.KeyValue) (respBody []byte, respHdr map[string]string)

REST emulates a Http REST request.

func (*Gateway) RPC added in v0.10.0

func (g *Gateway) RPC(connID uint64, streamID int64, data []byte) error

RPC emulates sending an RPC command to the connection. It opens a non-persistent connection if connID does not exists

func (*Gateway) Run

func (g *Gateway) Run()

func (*Gateway) Shutdown

func (g *Gateway) Shutdown()

func (*Gateway) Start

func (g *Gateway) Start()

Jump to

Keyboard shortcuts

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