api

package
v3.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCKeyAuth

func GRPCKeyAuth(key string) grpc.ServerOption

GRPCKeyAuth allows to set simple authentication based on string key from configuration. Client should provide per RPC credentials: set authorization key to metadata with value `apikey <KEY>`.

func RegisterGRPCServerAPI

func RegisterGRPCServerAPI(n *centrifuge.Node, apiExecutor *Executor, server *grpc.Server, config GRPCAPIServiceConfig) error

RegisterGRPCServerAPI registers GRPC API service in provided GRPC server.

Types

type Config

type Config struct{}

Config configures APIHandler.

type Executor

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

Executor can run API methods.

func NewExecutor

func NewExecutor(n *centrifuge.Node, ruleContainer *rule.Container, surveyCaller SurveyCaller, protocol string) *Executor

NewExecutor ...

func (*Executor) Broadcast

func (h *Executor) Broadcast(_ context.Context, cmd *BroadcastRequest) *BroadcastResponse

Broadcast publishes the same data into many channels.

func (*Executor) Channels

func (h *Executor) Channels(ctx context.Context, cmd *ChannelsRequest) *ChannelsResponse

Channels in the system.

func (*Executor) Disconnect

func (h *Executor) Disconnect(_ context.Context, cmd *DisconnectRequest) *DisconnectResponse

Disconnect disconnects user by its ID and sends disconnect control message to other nodes, so they could also disconnect user.

func (*Executor) History

func (h *Executor) History(_ context.Context, cmd *HistoryRequest) *HistoryResponse

History returns response with history information for channel.

func (*Executor) HistoryRemove

func (h *Executor) HistoryRemove(_ context.Context, cmd *HistoryRemoveRequest) *HistoryRemoveResponse

HistoryRemove removes all history information for channel.

func (*Executor) Info

func (h *Executor) Info(_ context.Context, _ *InfoRequest) *InfoResponse

Info returns information about running nodes.

func (*Executor) Presence

func (h *Executor) Presence(_ context.Context, cmd *PresenceRequest) *PresenceResponse

Presence returns response with presence information for channel.

func (*Executor) PresenceStats

func (h *Executor) PresenceStats(_ context.Context, cmd *PresenceStatsRequest) *PresenceStatsResponse

PresenceStats returns response with presence stats information for channel.

func (*Executor) Publish

func (h *Executor) Publish(_ context.Context, cmd *PublishRequest) *PublishResponse

Publish publishes data into channel.

func (*Executor) RPC

func (h *Executor) RPC(ctx context.Context, cmd *RPCRequest) *RPCResponse

RPC can call arbitrary methods.

func (*Executor) Refresh

func (h *Executor) Refresh(_ context.Context, cmd *RefreshRequest) *RefreshResponse

Refresh user connection by its ID.

func (Executor) SetRPCExtension

func (h Executor) SetRPCExtension(method string, handler RPCHandler)

SetRPCExtension ...

func (*Executor) Subscribe

func (h *Executor) Subscribe(_ context.Context, cmd *SubscribeRequest) *SubscribeResponse

Subscribe subscribes user to a channel and sends subscribe control message to other nodes so they could also subscribe user.

func (*Executor) Unsubscribe

func (h *Executor) Unsubscribe(_ context.Context, cmd *UnsubscribeRequest) *UnsubscribeResponse

Unsubscribe unsubscribes user from channel and sends unsubscribe control message to other nodes so they could also unsubscribe user.

type GRPCAPIServiceConfig

type GRPCAPIServiceConfig struct{}

GRPCAPIServiceConfig for GRPC API Service.

type Handler

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

Handler is responsible for processing API commands over HTTP.

func NewHandler

func NewHandler(n *centrifuge.Node, apiExecutor *Executor, c Config) *Handler

NewHandler creates new APIHandler.

func (*Handler) ServeHTTP

func (s *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RPCHandler

type RPCHandler func(ctx context.Context, params Raw) (Raw, error)

RPCHandler allows to handle custom RPC.

type SurveyCaller

type SurveyCaller interface {
	Channels(ctx context.Context, cmd *ChannelsRequest) (map[string]*ChannelInfo, error)
}

SurveyCaller can do surveys.

Jump to

Keyboard shortcuts

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