gate_client

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Request       = "request"
	Response      = "response"
	StatusSuccess = "success"
	StatusError   = "error"
)
View Source
const (
	GateStatusWait         = "wait"
	GateStatusConnected    = "connected"
	GateStatusNotConnected = "not connected"
	GateStatusQuit         = "quit"
)
View Source
const (
	ClientTypeServer = "server"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GateClient

type GateClient struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewGateClient

func NewGateClient(adaptors *adaptors.Adaptors,
	graceful *graceful_service.GracefulService,
	metric *metrics.MetricManager) (gate *GateClient)

func (*GateClient) AddMobile

func (g *GateClient) AddMobile(ctx context.Context) (list *MobileList, err error)

func (*GateClient) Broadcast added in v0.0.15

func (g *GateClient) Broadcast(message []byte)

func (*GateClient) Close

func (g *GateClient) Close()

func (*GateClient) DeleteMobile

func (g *GateClient) DeleteMobile(token string, ctx context.Context) (list *MobileList, err error)

func (*GateClient) GetMobileList

func (g *GateClient) GetMobileList(ctx context.Context) (list *MobileList, err error)

func (*GateClient) GetSettings

func (g *GateClient) GetSettings() (Settings, error)

func (*GateClient) RegisterServer added in v0.0.13

func (g *GateClient) RegisterServer()

func (*GateClient) RequestFromMobileProxy added in v0.0.11

func (g *GateClient) RequestFromMobileProxy(message stream.Message)

func (*GateClient) Restart added in v0.0.13

func (g *GateClient) Restart()

func (*GateClient) Send

func (g *GateClient) Send(command string, payload map[string]interface{}, ctx context.Context, f func(msg stream.Message)) (err error)

func (*GateClient) SetEngine added in v0.0.11

func (g *GateClient) SetEngine(engine *gin.Engine)

func (*GateClient) Shutdown

func (g *GateClient) Shutdown()

func (*GateClient) Status

func (g *GateClient) Status() string

func (*GateClient) Subscribe

func (g *GateClient) Subscribe(command string, f func(client stream.IStreamClient, msg stream.Message))

func (*GateClient) UnSubscribe

func (g *GateClient) UnSubscribe(command string)

func (*GateClient) UpdateSettings

func (g *GateClient) UpdateSettings(settings Settings) (err error)

type IWsCallback

type IWsCallback interface {
	// contains filtered or unexported methods
}

type MobileList

type MobileList struct {
	Total     int64    `json:"total"`
	TokenList []string `json:"token_list"`
}

type Settings

type Settings struct {
	GateServerToken string `json:"gate_server_token"`
	Address         string `json:"address"`
	Enabled         bool   `json:"enabled"`
}

func (Settings) Equal added in v0.0.25

func (s Settings) Equal(v Settings) bool

func (Settings) Valid

func (s Settings) Valid() bool

type StreamRequestModel added in v0.0.11

type StreamRequestModel struct {
	URI    string      `json:"uri"`
	Method string      `json:"method"`
	Body   []byte      `json:"body"`
	Header http.Header `json:"header"`
}

type StreamResponseModel added in v0.0.11

type StreamResponseModel struct {
	Code   int         `json:"code"`
	Body   []byte      `json:"body"`
	Header http.Header `json:"header"`
}

type WsClient

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

func NewWsClient

func NewWsClient(cb IWsCallback, metric *metrics.MetricManager) *WsClient

func (*WsClient) Close

func (client *WsClient) Close()

func (*WsClient) Notify added in v0.1.1

func (client *WsClient) Notify(t, b string)

func (*WsClient) Status added in v0.0.25

func (client *WsClient) Status() string

func (*WsClient) UpdateSettings added in v0.0.23

func (client *WsClient) UpdateSettings(settings Settings)

func (*WsClient) Write added in v0.1.1

func (client *WsClient) Write(payload []byte) (err error)

Jump to

Keyboard shortcuts

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