proto

package
v0.0.0-...-56739e2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package proto is a generated protocol buffer package.

It is generated from these files:

message.proto

It has these top-level messages:

ClientInfo
Message
JoinMessage
LeaveMessage
ControlMessage
AdminMessage

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidMessage means that you sent invalid message to Centrifugo.
	ErrInvalidMessage = errors.New("invalid message")
	// ErrMethodNotFound means that method sent in command does not exist.
	ErrMethodNotFound = errors.New("method not found")
	// ErrNamespaceNotFound means that namespace in channel name does not exist.
	ErrNamespaceNotFound = errors.New("namespace not found")
	// ErrInternalServerError means server error, if returned this is a signal that
	// something went wrong with Centrifugo itself.
	ErrInternalServerError = errors.New("internal server error")
	// ErrNotAvailable means that resource is not enabled.
	ErrNotAvailable = errors.New("not available")
	// ErrUnauthorized means unauthorized access.
	ErrUnauthorized = errors.New("unauthorized")
	// ErrClientClosed means that client connection already closed.
	ErrClientClosed = errors.New("client is closed")
	// ErrInvalidToken means that client sent invalid token.
	ErrInvalidToken = errors.New("invalid token")
	// ErrPermissionDenied means that access to resource not allowed.
	ErrPermissionDenied = errors.New("permission denied")
	// ErrAlreadySubscribed returned when client wants to subscribe on channel
	// it already subscribed to.
	ErrAlreadySubscribed = errors.New("already subscribed")
	// ErrLimitExceeded says that some sort of limit exceeded, server logs should give
	// more detailed information.
	ErrLimitExceeded = errors.New("limit exceeded")
	// ErrSendTimeout means that timeout occurred when sending message into connection.
	ErrSendTimeout = errors.New("send timeout")
)
View Source
var (
	ErrInvalidLengthMessage = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMessage   = fmt.Errorf("proto: integer overflow")
)

Functions

func EncodeJSONString

func EncodeJSONString(buf *bytebufferpool.ByteBuffer, s string, escapeHTML bool)

EncodeJSONString escapes string value when encoding it to JSON. From https://golang.org/src/encoding/json/encode.go

Types

type APIBroadcastResponse

type APIBroadcastResponse struct {
	Body interface{} `json:"body"` // TODO: interface{} for API protocol backwards compatibility.
	// contains filtered or unexported fields
}

APIBroadcastResponse represents response to broadcast API command.

func NewAPIBroadcastResponse

func NewAPIBroadcastResponse() *APIBroadcastResponse

NewAPIBroadcastResponse initializes APIBroadcastResponse.

func (*APIBroadcastResponse) SetErr

func (r *APIBroadcastResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIBroadcastResponse) SetUID

func (r *APIBroadcastResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APIChannelsResponse

type APIChannelsResponse struct {
	Body ChannelsBody `json:"body"`
	// contains filtered or unexported fields
}

APIChannelsResponse represents response to API channels command.

func NewAPIChannelsResponse

func NewAPIChannelsResponse(body ChannelsBody) *APIChannelsResponse

NewAPIChannelsResponse initializes APIChannelsResponse.

func (*APIChannelsResponse) SetErr

func (r *APIChannelsResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIChannelsResponse) SetUID

func (r *APIChannelsResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APICommand

type APICommand struct {
	UID    string  `json:"uid"`
	Method string  `json:"method"`
	Params raw.Raw `json:"params"`
}

APICommand describes API request command struct.

type APIDisconnectResponse

type APIDisconnectResponse struct {
	Body interface{} `json:"body"` // TODO: interface{} for API protocol backwards compatibility.
	// contains filtered or unexported fields
}

APIDisconnectResponse represents response to API disconnect command.

func NewAPIDisconnectResponse

func NewAPIDisconnectResponse() *APIDisconnectResponse

NewAPIDisconnectResponse initializes APIDisconnectResponse.

func (*APIDisconnectResponse) SetErr

func (r *APIDisconnectResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIDisconnectResponse) SetUID

func (r *APIDisconnectResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APIHistoryResponse

type APIHistoryResponse struct {
	Body HistoryBody `json:"body"`
	// contains filtered or unexported fields
}

APIHistoryResponse represents response to API history command.

func NewAPIHistoryResponse

func NewAPIHistoryResponse(body HistoryBody) *APIHistoryResponse

NewAPIHistoryResponse initializes APIHistoryResponse.

func (*APIHistoryResponse) SetErr

func (r *APIHistoryResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIHistoryResponse) SetUID

func (r *APIHistoryResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APINodeResponse

type APINodeResponse struct {
	Body NodeBody `json:"body"`
	// contains filtered or unexported fields
}

APINodeResponse represents response to API node command.

func NewAPINodeResponse

func NewAPINodeResponse(body NodeBody) *APINodeResponse

NewAPINodeResponse initializes APINodeResponse.

func (*APINodeResponse) SetErr

func (r *APINodeResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APINodeResponse) SetUID

func (r *APINodeResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APIPresenceResponse

type APIPresenceResponse struct {
	Body PresenceBody `json:"body"`
	// contains filtered or unexported fields
}

APIPresenceResponse represents response to API presence command.

func NewAPIPresenceResponse

func NewAPIPresenceResponse(body PresenceBody) *APIPresenceResponse

NewAPIPresenceResponse initializes APIPresenceResponse.

func (*APIPresenceResponse) SetErr

func (r *APIPresenceResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIPresenceResponse) SetUID

func (r *APIPresenceResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APIPublishResponse

type APIPublishResponse struct {
	Body interface{} `json:"body"` // TODO: interface{} for API protocol backwards compatibility.
	// contains filtered or unexported fields
}

APIPublishResponse represents response to API publish command.

func NewAPIPublishResponse

func NewAPIPublishResponse() *APIPublishResponse

NewAPIPublishResponse initializes APIPublishResponse.

func (*APIPublishResponse) SetErr

func (r *APIPublishResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIPublishResponse) SetUID

func (r *APIPublishResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APIStatsResponse

type APIStatsResponse struct {
	Body StatsBody `json:"body"`
	// contains filtered or unexported fields
}

APIStatsResponse represents response to API stats command.

func NewAPIStatsResponse

func NewAPIStatsResponse(body StatsBody) *APIStatsResponse

NewAPIStatsResponse initializes APIStatsResponse.

func (*APIStatsResponse) SetErr

func (r *APIStatsResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIStatsResponse) SetUID

func (r *APIStatsResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type APIUnsubscribeResponse

type APIUnsubscribeResponse struct {
	Body interface{} `json:"body"` // TODO: interface{} for API protocol backwards compatibility.
	// contains filtered or unexported fields
}

APIUnsubscribeResponse represents response to API unsubscribe command.

func NewAPIUnsubscribeResponse

func NewAPIUnsubscribeResponse() *APIUnsubscribeResponse

NewAPIUnsubscribeResponse initializes APIUnsubscribeResponse.

func (*APIUnsubscribeResponse) SetErr

func (r *APIUnsubscribeResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*APIUnsubscribeResponse) SetUID

func (r *APIUnsubscribeResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type AdminConnectResponse

type AdminConnectResponse struct {
	Body bool `json:"body"`
	// contains filtered or unexported fields
}

AdminConnectResponse represents response to admin connect command.

func NewAdminConnectResponse

func NewAdminConnectResponse(body bool) *AdminConnectResponse

NewAdminConnectResponse initializes AdminConnectResponse.

func (*AdminConnectResponse) SetErr

func (r *AdminConnectResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*AdminConnectResponse) SetUID

func (r *AdminConnectResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type AdminInfoBody

type AdminInfoBody struct {
	Data map[string]interface{} `json:"data"`
}

AdminInfoBody represents response to admin info command.

type AdminInfoResponse

type AdminInfoResponse struct {
	Body AdminInfoBody `json:"body"`
	// contains filtered or unexported fields
}

AdminInfoResponse represents response to admin info command.

func NewAdminInfoResponse

func NewAdminInfoResponse(body AdminInfoBody) *AdminInfoResponse

NewAdminInfoResponse initializes AdminInfoResponse.

func (*AdminInfoResponse) SetErr

func (r *AdminInfoResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*AdminInfoResponse) SetUID

func (r *AdminInfoResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type AdminMessage

type AdminMessage struct {
	UID    string                                                  `protobuf:"bytes,1,opt,name=UID,proto3" json:"uid"`
	Method string                                                  `protobuf:"bytes,2,opt,name=Method,proto3" json:"method"`
	Params github_com_centrifugal_centrifugo_libcentrifugo_raw.Raw `protobuf:"bytes,3,opt,name=Params,proto3,customtype=github.com/centrifugal/centrifugo/libcentrifugo/raw.Raw" json:"params"`
}

func NewAdminMessage

func NewAdminMessage(method string, params []byte) *AdminMessage

NewAdminMessage initializes new AdminMessage.

func NewPopulatedAdminMessage

func NewPopulatedAdminMessage(r randyMessage, easy bool) *AdminMessage

func (*AdminMessage) Descriptor

func (*AdminMessage) Descriptor() ([]byte, []int)

func (*AdminMessage) Equal

func (this *AdminMessage) Equal(that interface{}) bool

func (*AdminMessage) Marshal

func (m *AdminMessage) Marshal() (dAtA []byte, err error)

func (*AdminMessage) MarshalTo

func (m *AdminMessage) MarshalTo(dAtA []byte) (int, error)

func (*AdminMessage) ProtoMessage

func (*AdminMessage) ProtoMessage()

func (*AdminMessage) Reset

func (m *AdminMessage) Reset()

func (*AdminMessage) Size

func (m *AdminMessage) Size() (n int)

func (*AdminMessage) String

func (m *AdminMessage) String() string

func (*AdminMessage) Unmarshal

func (m *AdminMessage) Unmarshal(dAtA []byte) error

type AdminMessageResponse

type AdminMessageResponse struct {
	Body raw.Raw `json:"body"`
	// contains filtered or unexported fields
}

AdminMessageResponse is a new message for admin that watches.

func NewAdminMessageResponse

func NewAdminMessageResponse(body raw.Raw) *AdminMessageResponse

NewAdminMessageResponse initializes AdminMessageResponse.

func (*AdminMessageResponse) SetErr

func (r *AdminMessageResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*AdminMessageResponse) SetUID

func (r *AdminMessageResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type AdminPingResponse

type AdminPingResponse struct {
	Body string `json:"body"`
	// contains filtered or unexported fields
}

AdminPingResponse represents response to admin ping command.

func NewAdminPingResponse

func NewAdminPingResponse(body string) *AdminPingResponse

NewAdminPingResponse initializes AdminPingResponse.

func (*AdminPingResponse) SetErr

func (r *AdminPingResponse) SetErr(err ResponseError)

SetErr sets an error message on the api response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*AdminPingResponse) SetUID

func (r *AdminPingResponse) SetUID(uid string)

SetUID allows to set uid to api response.

type BroadcastAPICommand

type BroadcastAPICommand struct {
	Channels []string `json:"channels"`
	Data     raw.Raw  `json:"data"`
	Client   string   `json:"client"`
}

BroadcastAPICommand is used to publish messages into multiple channels.

type ChannelOptions

type ChannelOptions struct {
	// Watch determines if message published into channel will be also sent into admin channel.
	// Note that this option must be used carefully in channels with high rate of new messages
	// as admin client can not process all of those messages. Use this option for testing or for
	// channels with reasonable message rate.
	Watch bool `json:"watch"`

	// Publish determines if client can publish messages into channel directly. This allows to use
	// Centrifugo without backend. All messages go through Centrifugo and delivered to clients. But
	// in this case you lose everything your backend code could give - validation, persistence etc.
	// This option most useful for demos, testing real-time ideas.
	Publish bool `json:"publish"`

	// Anonymous determines is anonymous access (with empty user ID) allowed or not. In most
	// situations your application works with authorized users so every user has its own unique
	// id. But if you provide real-time features for public access you may need anauthorized
	// access to channels. Turn on this option and use empty string as user ID.
	Anonymous bool `json:"anonymous"`

	// Presence turns on(off) presence information for channels. Presence is a structure with
	// clients currently subscribed on channel.
	Presence bool `json:"presence"`

	// JoinLeave turns on(off) join/leave messages for channels. When client subscribes on channel
	// join message sent to all clients in this channel. When client leaves channel (unsubscribes)
	// leave message sent.
	JoinLeave bool `mapstructure:"join_leave" json:"join_leave"`

	// HistorySize determines max amount of history messages for channel, 0 means no history for channel.
	// Centrifugo history has auxiliary role – it can not replace your backend persistent storage.
	HistorySize int `mapstructure:"history_size" json:"history_size"`

	// HistoryLifetime determines time in seconds until expiration for history messages. As Centrifugo
	// keeps history in memory (in process memory or in Redis process memory) it's important to remove
	// old messages to prevent infinite memory grows.
	HistoryLifetime int `mapstructure:"history_lifetime" json:"history_lifetime"`

	// Recover enables recover mechanism for channels. This means that Centrifugo will
	// try to recover missed messages for resubscribing client. This option uses messages
	// from history and must be used with reasonable HistorySize and HistoryLifetime
	// configuration.
	Recover bool `json:"recover"`

	// HistoryDropInactive enables an optimization where history is only saved for channels that have at
	// least one active subscriber. This can give a huge memory saving, with only minor edgecases that are
	// different from without it as noted on https://github.com/centrifugal/centrifugo/issues/50.
	HistoryDropInactive bool `mapstructure:"history_drop_inactive" json:"history_drop_inactive"`
}

ChannelOptions represent channel specific configuration for namespace or project in a whole

type ChannelsBody

type ChannelsBody struct {
	Data []string `json:"data"`
}

ChannelsBody represents body of response in case of successful channels command.

type ClientCommand

type ClientCommand struct {
	UID    string  `json:"uid"`
	Method string  `json:"method"`
	Params raw.Raw `json:"params"`
}

ClientCommand describes client connection command struct.

func ClientCommandsFromJSON

func ClientCommandsFromJSON(msgBytes []byte) ([]ClientCommand, error)

ClientCommandsFromJSON extracts slice of ClientCommand from client request encoded as JSON.

type ClientConnectResponse

type ClientConnectResponse struct {
	Body ConnectBody `json:"body"`
	// contains filtered or unexported fields
}

ClientConnectResponse represents response to client connect command.

func NewClientConnectResponse

func NewClientConnectResponse(body ConnectBody) *ClientConnectResponse

NewClientConnectResponse initializes ClientConnectResponse.

func (*ClientConnectResponse) SetErr

func (r *ClientConnectResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientConnectResponse) SetUID

func (r *ClientConnectResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ClientHistoryResponse

type ClientHistoryResponse struct {
	Body HistoryBody `json:"body"`
	// contains filtered or unexported fields
}

ClientHistoryResponse represents response to client history command.

func NewClientHistoryResponse

func NewClientHistoryResponse(body HistoryBody) *ClientHistoryResponse

NewClientHistoryResponse initializes ClientHistoryResponse.

func (*ClientHistoryResponse) SetErr

func (r *ClientHistoryResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientHistoryResponse) SetUID

func (r *ClientHistoryResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ClientInfo

type ClientInfo struct {
	User        string                                                  `protobuf:"bytes,1,opt,name=User,proto3" json:"user"`
	Client      string                                                  `protobuf:"bytes,2,opt,name=Client,proto3" json:"client"`
	DefaultInfo github_com_centrifugal_centrifugo_libcentrifugo_raw.Raw `` /* 143-byte string literal not displayed */
	ChannelInfo github_com_centrifugal_centrifugo_libcentrifugo_raw.Raw `` /* 143-byte string literal not displayed */
}

func NewClientInfo

func NewClientInfo(user string, client string, defaultInfo raw.Raw, channelInfo raw.Raw) *ClientInfo

NewClientInfo allows to initialize ClientInfo.

func NewPopulatedClientInfo

func NewPopulatedClientInfo(r randyMessage, easy bool) *ClientInfo

func (*ClientInfo) Descriptor

func (*ClientInfo) Descriptor() ([]byte, []int)

func (*ClientInfo) Equal

func (this *ClientInfo) Equal(that interface{}) bool

func (*ClientInfo) Marshal

func (m *ClientInfo) Marshal() (dAtA []byte, err error)

func (*ClientInfo) MarshalTo

func (m *ClientInfo) MarshalTo(dAtA []byte) (int, error)

func (*ClientInfo) ProtoMessage

func (*ClientInfo) ProtoMessage()

func (*ClientInfo) Reset

func (m *ClientInfo) Reset()

func (*ClientInfo) Size

func (m *ClientInfo) Size() (n int)

func (*ClientInfo) String

func (m *ClientInfo) String() string

func (*ClientInfo) Unmarshal

func (m *ClientInfo) Unmarshal(dAtA []byte) error

type ClientJoinResponse

type ClientJoinResponse struct {
	Method string      `json:"method"`
	Body   JoinMessage `json:"body"`
}

ClientJoinResponse sent to client when someone subscribed on channel.

func NewClientJoinMessage

func NewClientJoinMessage(msg *JoinMessage) *ClientJoinResponse

NewClientJoinMessage initializes ClientJoinResponse.

func (*ClientJoinResponse) Marshal

func (m *ClientJoinResponse) Marshal() ([]byte, error)

Marshal marshals ClientJoinResponse into JSON using buffer pool and manual JSON construction.

type ClientLeaveResponse

type ClientLeaveResponse struct {
	Method string       `json:"method"`
	Body   LeaveMessage `json:"body"`
}

ClientLeaveResponse sent when someone unsubscribes from channel.

func NewClientLeaveMessage

func NewClientLeaveMessage(msg *LeaveMessage) *ClientLeaveResponse

NewClientLeaveMessage initializes ClientLeaveResponse.

func (*ClientLeaveResponse) Marshal

func (m *ClientLeaveResponse) Marshal() ([]byte, error)

Marshal marshals ClientLeaveResponse into JSON using buffer pool and manual JSON construction.

type ClientMessageResponse

type ClientMessageResponse struct {
	Method string  `json:"method"`
	Body   Message `json:"body"`
}

ClientMessageResponse can not have an error.

func NewClientMessage

func NewClientMessage(msg *Message) *ClientMessageResponse

NewClientMessage returns initialized client message response.

func (*ClientMessageResponse) Marshal

func (m *ClientMessageResponse) Marshal() ([]byte, error)

Marshal marshals ClientMessageResponse into JSON using buffer pool and manual JSON construction.

type ClientPingResponse

type ClientPingResponse struct {
	Body *PingBody `json:"body,omitempty"`
	// contains filtered or unexported fields
}

ClientPingResponse represents response to client ping command.

func NewClientPingResponse

func NewClientPingResponse(body *PingBody) *ClientPingResponse

NewClientPingResponse initializes ClientPingResponse.

func (*ClientPingResponse) SetErr

func (r *ClientPingResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientPingResponse) SetUID

func (r *ClientPingResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ClientPresenceResponse

type ClientPresenceResponse struct {
	Body PresenceBody `json:"body"`
	// contains filtered or unexported fields
}

ClientPresenceResponse represents response to client presence command.

func NewClientPresenceResponse

func NewClientPresenceResponse(body PresenceBody) *ClientPresenceResponse

NewClientPresenceResponse initializes ClientPresenceResponse.

func (*ClientPresenceResponse) SetErr

func (r *ClientPresenceResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientPresenceResponse) SetUID

func (r *ClientPresenceResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ClientPublishResponse

type ClientPublishResponse struct {
	Body PublishBody `json:"body"`
	// contains filtered or unexported fields
}

ClientPublishResponse represents response to ClientPublishResponse.

func NewClientPublishResponse

func NewClientPublishResponse(body PublishBody) *ClientPublishResponse

NewClientPublishResponse initializes ClientPublishResponse.

func (*ClientPublishResponse) SetErr

func (r *ClientPublishResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientPublishResponse) SetUID

func (r *ClientPublishResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ClientRefreshResponse

type ClientRefreshResponse struct {
	Body ConnectBody `json:"body"`
	// contains filtered or unexported fields
}

ClientRefreshResponse represents response to client refresh command.

func NewClientRefreshResponse

func NewClientRefreshResponse(body ConnectBody) *ClientRefreshResponse

NewClientRefreshResponse initializes ClientRefreshResponse.

func (*ClientRefreshResponse) SetErr

func (r *ClientRefreshResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientRefreshResponse) SetUID

func (r *ClientRefreshResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ClientSubscribeResponse

type ClientSubscribeResponse struct {
	Body SubscribeBody `json:"body"`
	// contains filtered or unexported fields
}

ClientSubscribeResponse represents response to client subscribe command.

func NewClientSubscribeResponse

func NewClientSubscribeResponse(body SubscribeBody) *ClientSubscribeResponse

NewClientSubscribeResponse initializes ClientSubscribeResponse.

func (*ClientSubscribeResponse) SetErr

func (r *ClientSubscribeResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientSubscribeResponse) SetUID

func (r *ClientSubscribeResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ClientUnsubscribeResponse

type ClientUnsubscribeResponse struct {
	Body UnsubscribeBody `json:"body"`
	// contains filtered or unexported fields
}

ClientUnsubscribeResponse represents response to client unsubscribe command.

func NewClientUnsubscribeResponse

func NewClientUnsubscribeResponse(body UnsubscribeBody) *ClientUnsubscribeResponse

NewClientUnsubscribeResponse initializes ClientUnsubscribeResponse.

func (*ClientUnsubscribeResponse) SetErr

func (r *ClientUnsubscribeResponse) SetErr(err ResponseError)

SetErr sets a client error on the client response and updates the 'err' field in the response. If an error has already been set it will be kept.

func (*ClientUnsubscribeResponse) SetUID

func (r *ClientUnsubscribeResponse) SetUID(uid string)

SetUID sets unique uid which must be equal to request uid.

type ConnectAdminCommand

type ConnectAdminCommand struct {
	Token string `json:"token"`
	Watch bool   `json:"watch"`
}

ConnectAdminCommand required to authorize admin connection and provide connection options.

type ConnectBody

type ConnectBody struct {
	Version string `json:"version"`
	Client  string `json:"client"`
	Expires bool   `json:"expires"`
	Expired bool   `json:"expired"`
	TTL     int64  `json:"ttl"`
}

ConnectBody represents body of response in case of successful connect command.

type ConnectClientCommand

type ConnectClientCommand struct {
	User      string `json:"user"`
	Timestamp string `json:"timestamp"`
	Info      string `json:"info"`
	Token     string `json:"token"`
}

ConnectClientCommand is a command to authorize connection - it contains user ID in web application, additional connection information as JSON string, timestamp with unix seconds on moment when connect parameters generated and HMAC token to prove correctness of all those parameters.

type ControlMessage

type ControlMessage struct {
	// UID in case of controlCommand is a unique node ID which originally published
	// this control command.
	UID    string                                                  `protobuf:"bytes,1,opt,name=UID,proto3" json:"uid"`
	Method string                                                  `protobuf:"bytes,2,opt,name=Method,proto3" json:"method"`
	Params github_com_centrifugal_centrifugo_libcentrifugo_raw.Raw `protobuf:"bytes,3,opt,name=Params,proto3,customtype=github.com/centrifugal/centrifugo/libcentrifugo/raw.Raw" json:"params"`
}

func NewControlMessage

func NewControlMessage(uid string, method string, params []byte) *ControlMessage

NewControlMessage initializes new ControlMessage.

func NewPopulatedControlMessage

func NewPopulatedControlMessage(r randyMessage, easy bool) *ControlMessage

func (*ControlMessage) Descriptor

func (*ControlMessage) Descriptor() ([]byte, []int)

func (*ControlMessage) Equal

func (this *ControlMessage) Equal(that interface{}) bool

func (*ControlMessage) Marshal

func (m *ControlMessage) Marshal() (dAtA []byte, err error)

func (*ControlMessage) MarshalTo

func (m *ControlMessage) MarshalTo(dAtA []byte) (int, error)

func (*ControlMessage) ProtoMessage

func (*ControlMessage) ProtoMessage()

func (*ControlMessage) Reset

func (m *ControlMessage) Reset()

func (*ControlMessage) Size

func (m *ControlMessage) Size() (n int)

func (*ControlMessage) String

func (m *ControlMessage) String() string

func (*ControlMessage) Unmarshal

func (m *ControlMessage) Unmarshal(dAtA []byte) error

type DisconnectAPICommand

type DisconnectAPICommand struct {
	User string `json:"user"`
}

DisconnectAPICommand is used to disconnect user.

type DisconnectControlCommand

type DisconnectControlCommand struct {
	User string `json:"user"`
}

DisconnectControlCommand required to disconnect user from all nodes.

type ErrorAdvice

type ErrorAdvice string

ErrorAdvice is a string which is sent in case of error. It contains advice how client should behave when error occurred.

const (
	// ErrorAdviceNone represents undefined advice.
	ErrorAdviceNone ErrorAdvice = ""
	// ErrorAdviceFix says that developer most probably made a mistake working with Centrifugo.
	ErrorAdviceFix ErrorAdvice = "fix"
	// ErrorAdviceRetry says that operation can't be done at moment but may be possible in future.
	ErrorAdviceRetry ErrorAdvice = "retry"
)

type HistoryAPICommand

type HistoryAPICommand struct {
	Channel string `json:"channel"`
}

HistoryAPICommand is used to get history information for channel.

type HistoryBody

type HistoryBody struct {
	Channel string    `json:"channel"`
	Data    []Message `json:"data"`
}

HistoryBody represents body of response in case of successful history command.

type HistoryClientCommand

type HistoryClientCommand struct {
	Channel string `json:"channel"`
}

HistoryClientCommand is used to get history information for channel.

type JoinMessage

type JoinMessage struct {
	Channel string     `protobuf:"bytes,1,opt,name=Channel,proto3" json:"channel"`
	Data    ClientInfo `protobuf:"bytes,2,opt,name=Data" json:"data"`
}

func NewJoinMessage

func NewJoinMessage(ch string, info ClientInfo) *JoinMessage

NewJoinMessage initializes new JoinMessage.

func NewPopulatedJoinMessage

func NewPopulatedJoinMessage(r randyMessage, easy bool) *JoinMessage

func (*JoinMessage) Descriptor

func (*JoinMessage) Descriptor() ([]byte, []int)

func (*JoinMessage) Equal

func (this *JoinMessage) Equal(that interface{}) bool

func (*JoinMessage) GetData

func (m *JoinMessage) GetData() ClientInfo

func (*JoinMessage) Marshal

func (m *JoinMessage) Marshal() (dAtA []byte, err error)

func (*JoinMessage) MarshalTo

func (m *JoinMessage) MarshalTo(dAtA []byte) (int, error)

func (*JoinMessage) ProtoMessage

func (*JoinMessage) ProtoMessage()

func (*JoinMessage) Reset

func (m *JoinMessage) Reset()

func (*JoinMessage) Size

func (m *JoinMessage) Size() (n int)

func (*JoinMessage) String

func (m *JoinMessage) String() string

func (*JoinMessage) Unmarshal

func (m *JoinMessage) Unmarshal(dAtA []byte) error

type LeaveMessage

type LeaveMessage struct {
	Channel string     `protobuf:"bytes,1,opt,name=Channel,proto3" json:"channel"`
	Data    ClientInfo `protobuf:"bytes,2,opt,name=Data" json:"data"`
}

func NewLeaveMessage

func NewLeaveMessage(ch string, info ClientInfo) *LeaveMessage

NewLeaveMessage initializes new LeaveMessage.

func NewPopulatedLeaveMessage

func NewPopulatedLeaveMessage(r randyMessage, easy bool) *LeaveMessage

func (*LeaveMessage) Descriptor

func (*LeaveMessage) Descriptor() ([]byte, []int)

func (*LeaveMessage) Equal

func (this *LeaveMessage) Equal(that interface{}) bool

func (*LeaveMessage) GetData

func (m *LeaveMessage) GetData() ClientInfo

func (*LeaveMessage) Marshal

func (m *LeaveMessage) Marshal() (dAtA []byte, err error)

func (*LeaveMessage) MarshalTo

func (m *LeaveMessage) MarshalTo(dAtA []byte) (int, error)

func (*LeaveMessage) ProtoMessage

func (*LeaveMessage) ProtoMessage()

func (*LeaveMessage) Reset

func (m *LeaveMessage) Reset()

func (*LeaveMessage) Size

func (m *LeaveMessage) Size() (n int)

func (*LeaveMessage) String

func (m *LeaveMessage) String() string

func (*LeaveMessage) Unmarshal

func (m *LeaveMessage) Unmarshal(dAtA []byte) error

type Message

type Message struct {
	UID     string                                                  `protobuf:"bytes,1,opt,name=UID,proto3" json:"uid"`
	Channel string                                                  `protobuf:"bytes,3,opt,name=Channel,proto3" json:"channel"`
	Data    github_com_centrifugal_centrifugo_libcentrifugo_raw.Raw `protobuf:"bytes,4,opt,name=Data,proto3,customtype=github.com/centrifugal/centrifugo/libcentrifugo/raw.Raw" json:"data"`
	Client  string                                                  `protobuf:"bytes,5,opt,name=Client,proto3" json:"client,omitempty"`
	Info    *ClientInfo                                             `protobuf:"bytes,6,opt,name=Info" json:"info,omitempty"`
}

func NewMessage

func NewMessage(ch string, data []byte, client string, info *ClientInfo) *Message

NewMessage initializes new Message.

func NewPopulatedMessage

func NewPopulatedMessage(r randyMessage, easy bool) *Message

func (*Message) Descriptor

func (*Message) Descriptor() ([]byte, []int)

func (*Message) Equal

func (this *Message) Equal(that interface{}) bool

func (*Message) GetInfo

func (m *Message) GetInfo() *ClientInfo

func (*Message) Marshal

func (m *Message) Marshal() (dAtA []byte, err error)

func (*Message) MarshalTo

func (m *Message) MarshalTo(dAtA []byte) (int, error)

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) Size

func (m *Message) Size() (n int)

func (*Message) String

func (m *Message) String() string

func (*Message) Unmarshal

func (m *Message) Unmarshal(dAtA []byte) error

type MultiAPIResponse

type MultiAPIResponse []Response

MultiAPIResponse is a slice of API responses returned as a result for slice of commands received by API in execution order - from first executed to last one.

type MultiClientResponse

type MultiClientResponse []Response

MultiClientResponse is a slice of responses in execution order - from first executed to last one

type NodeBody

type NodeBody struct {
	Data NodeInfo `json:"data"`
}

NodeBody represents body of response in case of successful node command.

type NodeInfo

type NodeInfo struct {
	UID     string           `json:"uid"`
	Name    string           `json:"name"`
	Started int64            `json:"started_at"`
	Metrics map[string]int64 `json:"metrics"`
	// contains filtered or unexported fields
}

NodeInfo contains information and statistics about Centrifugo node.

type PingAdminCommand

type PingAdminCommand struct {
	Data string `json:"data"`
}

PingAdminCommand is used to ping server.

type PingBody

type PingBody struct {
	Data string `json:"data,omitempty"`
}

PingBody represents body of response in case of successful ping command.

type PingClientCommand

type PingClientCommand struct {
	Data string `json:"data"`
}

PingClientCommand is used to ping server.

type PingControlCommand

type PingControlCommand struct {
	Info NodeInfo `json:"info"`
}

PingControlCommand allows nodes to know about each other - node sends this control command periodically.

type PresenceAPICommand

type PresenceAPICommand struct {
	Channel string `json:"channel"`
}

PresenceAPICommand is used to get presence (actual channel subscriptions) information for channel.

type PresenceBody

type PresenceBody struct {
	Channel string                `json:"channel"`
	Data    map[string]ClientInfo `json:"data"`
}

PresenceBody represents body of response in case of successful presence command.

type PresenceClientCommand

type PresenceClientCommand struct {
	Channel string `json:"channel"`
}

PresenceClientCommand is used to get presence (actual channel subscriptions). information for channel

type PublishAPICommand

type PublishAPICommand struct {
	Channel string  `json:"channel"`
	Client  string  `json:"client"`
	Data    raw.Raw `json:"data"`
}

PublishAPICommand is used to publish messages into channel.

type PublishBody

type PublishBody struct {
	Channel string `json:"channel"`
	Status  bool   `json:"status"`
}

PublishBody represents body of response in case of successful publish command.

type PublishClientCommand

type PublishClientCommand struct {
	Channel string  `json:"channel"`
	Data    raw.Raw `json:"data"`
}

PublishClientCommand is used to publish messages into channel.

type RefreshClientCommand

type RefreshClientCommand struct {
	User      string `json:"user"`
	Timestamp string `json:"timestamp"`
	Info      string `json:"info"`
	Token     string `json:"token"`
}

RefreshClientCommand is used to prolong connection lifetime when connection check mechanism is enabled. It can only be sent by client after successful connect.

type Response

type Response interface {
	SetErr(err ResponseError)
	SetUID(uid string)
}

Response is an interface describing response methods.

type ResponseError

type ResponseError struct {
	Err    error       `json:"-"`
	Advice ErrorAdvice `json:"advice,omitempty"`
}

ResponseError represents error in response.

type ServerStats

type ServerStats struct {
	Nodes           []NodeInfo `json:"nodes"`
	MetricsInterval int64      `json:"metrics_interval"`
}

ServerStats contains state and metrics information from running Centrifugo nodes.

type StatsBody

type StatsBody struct {
	Data ServerStats `json:"data"`
}

StatsBody represents body of response in case of successful stats command.

type SubscribeBody

type SubscribeBody struct {
	Channel   string    `json:"channel"`
	Status    bool      `json:"status"`
	Last      string    `json:"last"`
	Messages  []Message `json:"messages"`
	Recovered bool      `json:"recovered"`
}

SubscribeBody represents body of response in case of successful subscribe command.

type SubscribeClientCommand

type SubscribeClientCommand struct {
	Channel string `json:"channel"`
	Client  string `json:"client"`
	Last    string `json:"last"`
	Recover bool   `json:"recover"`
	Info    string `json:"info"`
	Sign    string `json:"sign"`
}

SubscribeClientCommand is used to subscribe on channel. It can only be sent by client after successful connect. It also can have Client, Info and Sign properties when channel is private.

type UnsubscribeAPICommand

type UnsubscribeAPICommand struct {
	Channel string `json:"channel"`
	User    string `json:"user"`
}

UnsubscribeAPICommand is used to unsubscribe user from channel.

type UnsubscribeBody

type UnsubscribeBody struct {
	Channel string `json:"channel"`
	Status  bool   `json:"status"`
}

UnsubscribeBody represents body of response in case of successful unsubscribe command.

type UnsubscribeClientCommand

type UnsubscribeClientCommand struct {
	Channel string `json:"channel"`
}

UnsubscribeClientCommand is used to unsubscribe from channel.

type UnsubscribeControlCommand

type UnsubscribeControlCommand struct {
	Channel string `json:"channel"`
	User    string `json:"user"`
}

UnsubscribeControlCommand required when node received unsubscribe API command – node unsubscribes user from channel and then send this control command so other nodes could unsubscribe user too.

Jump to

Keyboard shortcuts

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