Documentation ¶
Index ¶
Constants ¶
View Source
const ( SubscriberSubscribe int64 = 1 SubscriberUnsubscribe = 2 SubscriberUpdate = 5 )
View Source
const ( ChanCreate int64 = 1 ChanDelete = 2 ChanUpdate = 3 )
Variables ¶
View Source
var ( ErrChanNotExist = "channel does not exist" ErrChanAlreadyExists = "channel already exists" ErrChanClosed = "subscribe channel is closed" ErrAlreadySubscribed = "already subscribed" ErrNotSubscribed = "not subscribed" ErrNotPublisher = "not publisher" )
View Source
var (
ErrUnknownFlag = errors.New("unknown flag")
)
Functions ¶
This section is empty.
Types ¶
type ChanInfo ¶ added in v1.1.0
type ChanInfo struct { ID ChanID Type ChanType Muted bool Blocked bool Closed bool Parent *ChanID Child []ChanID }
func NewChanInfo ¶ added in v1.1.0
type Channel ¶
type Channel interface { Subscribe(id SubscriberID, extra interface{}) error Unsubscribe(id SubscriberID) error Update(i *ChanInfo) error Publish(msg Message) error Close() error }
type ChannelUpdate ¶
type ChannelUpdate struct { Flag int64 Extra interface{} }
type Message ¶
type Message interface { GetFrom() SubscriberID // GetChatMessage convert message body to *messages.ChatMessage GetChatMessage() (*messages.ChatMessage, error) }
Message is a message that can be publishing to channel.
type Subscribe ¶
type Subscribe interface { Interface SetGateInterface(gate gate.DefaultGateway) UpdateSubscriber(id ChanID, updates []Update) error UpdateChannel(id ChanID, update ChannelUpdate) error }
type Subscriber ¶
func (*Subscriber) Notify ¶
func (s *Subscriber) Notify(msg Message) error
type SubscriberID ¶ added in v1.1.0
type SubscriberID string
type Update ¶ added in v1.1.0
type Update struct { Flag int64 ID SubscriberID Extra interface{} }
Click to show internal directories.
Click to hide internal directories.