Documentation ¶
Index ¶
- Constants
- func SetLogger(l Logger)
- func TestWebsocketURL() *url.URL
- type ChannelIdentifier
- type Consumer
- type ConsumerOptions
- type Event
- type Logger
- type NilLogger
- func (l *NilLogger) Debug(message string)
- func (l *NilLogger) Debugf(message string, args ...interface{})
- func (l *NilLogger) Error(message string)
- func (l *NilLogger) Errorf(message string, args ...interface{})
- func (l *NilLogger) Info(message string)
- func (l *NilLogger) Infof(message string, args ...interface{})
- func (l *NilLogger) Warn(message string)
- func (l *NilLogger) Warnf(message string, args ...interface{})
- type StandardLibLogger
- func (l *StandardLibLogger) Debug(message string)
- func (l *StandardLibLogger) Debugf(message string, args ...interface{})
- func (l *StandardLibLogger) Error(message string)
- func (l *StandardLibLogger) Errorf(message string, args ...interface{})
- func (l *StandardLibLogger) Info(message string)
- func (l *StandardLibLogger) Infof(message string, args ...interface{})
- func (l *StandardLibLogger) Warn(message string)
- func (l *StandardLibLogger) Warnf(message string, args ...interface{})
- type Subscription
- type SubscriptionEvent
- type SubscriptionEventHandler
- type SubscriptionEventType
- type Subscriptions
Constants ¶
View Source
const ( // use the same value as actioncable.js // 1 ping is 2 sec interval, so detect stale when 2 ping missing. DEFAULT_STALE_THRESHOLD time.Duration = 6 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func TestWebsocketURL ¶
Types ¶
type ChannelIdentifier ¶
type ChannelIdentifier struct {
// contains filtered or unexported fields
}
func NewChannelIdentifier ¶
func NewChannelIdentifier(channelName string, params map[string]interface{}) *ChannelIdentifier
func (*ChannelIdentifier) Equals ¶
func (self *ChannelIdentifier) Equals(other *ChannelIdentifier) bool
func (*ChannelIdentifier) MarshalJSON ¶
func (c *ChannelIdentifier) MarshalJSON() ([]byte, error)
Implements json.Marshaler#MarshalJSON()
func (*ChannelIdentifier) UnmarshalJSON ¶
func (c *ChannelIdentifier) UnmarshalJSON(doubleEncodedData []byte) error
Implements json.Marshaler#UnmarshalJSON()
type Consumer ¶
type Consumer struct { Subscriptions *Subscriptions // contains filtered or unexported fields }
func CreateConsumer ¶
func CreateConsumer(url *url.URL, opts *ConsumerOptions) (*Consumer, error)
Passing in nil options will cause it to create the consumer with the default options.
func (*Consumer) Disconnect ¶
func (c *Consumer) Disconnect()
type ConsumerOptions ¶
type ConsumerOptions struct {
// contains filtered or unexported fields
}
func NewConsumerOptions ¶
func NewConsumerOptions() *ConsumerOptions
func (*ConsumerOptions) Header ¶
func (o *ConsumerOptions) Header() *http.Header
func (*ConsumerOptions) SetHeader ¶
func (o *ConsumerOptions) SetHeader(h *http.Header)
type Event ¶
type Event struct { Type string `json:"type"` Message json.RawMessage `json:"message"` Reason json.RawMessage `json:"reason"` Reconnect json.RawMessage `json:"reconnect"` Data json.RawMessage `json:"data"` Identifier *ChannelIdentifier `json:"identifier"` }
func NewNilEvent ¶
func NewNilEvent() *Event
type Logger ¶
type Logger interface { Debug(string) Debugf(string, ...interface{}) Info(string) Infof(string, ...interface{}) Warn(string) Warnf(string, ...interface{}) Error(string) Errorf(string, ...interface{}) }
func NewStandardLibLogger ¶
type StandardLibLogger ¶
type StandardLibLogger struct {
// contains filtered or unexported fields
}
func (*StandardLibLogger) Debug ¶
func (l *StandardLibLogger) Debug(message string)
func (*StandardLibLogger) Debugf ¶
func (l *StandardLibLogger) Debugf(message string, args ...interface{})
func (*StandardLibLogger) Error ¶
func (l *StandardLibLogger) Error(message string)
func (*StandardLibLogger) Errorf ¶
func (l *StandardLibLogger) Errorf(message string, args ...interface{})
func (*StandardLibLogger) Info ¶
func (l *StandardLibLogger) Info(message string)
func (*StandardLibLogger) Infof ¶
func (l *StandardLibLogger) Infof(message string, args ...interface{})
func (*StandardLibLogger) Warn ¶
func (l *StandardLibLogger) Warn(message string)
func (*StandardLibLogger) Warnf ¶
func (l *StandardLibLogger) Warnf(message string, args ...interface{})
type Subscription ¶
type Subscription struct { Identifier *ChannelIdentifier NotifyCh chan *SubscriptionEvent // contains filtered or unexported fields }
func (*Subscription) Perform ¶
func (s *Subscription) Perform(action string, data map[string]interface{})
func (*Subscription) Send ¶
func (s *Subscription) Send(data map[string]interface{})
func (*Subscription) SetHandler ¶
func (s *Subscription) SetHandler(h SubscriptionEventHandler)
func (*Subscription) Unsubscribe ¶
func (s *Subscription) Unsubscribe()
type SubscriptionEvent ¶
type SubscriptionEvent struct { Type SubscriptionEventType Message map[string]interface{} RawMessage *json.RawMessage }
func (*SubscriptionEvent) ReadJSON ¶
func (s *SubscriptionEvent) ReadJSON(v interface{}) error
type SubscriptionEventHandler ¶
type SubscriptionEventHandler interface { OnConnected(*SubscriptionEvent) OnDisconnected(*SubscriptionEvent) OnRejected(*SubscriptionEvent) OnReceived(*SubscriptionEvent) }
type SubscriptionEventType ¶
type SubscriptionEventType string
const ( Connected SubscriptionEventType = SubscriptionEventType("connected") Disconnected SubscriptionEventType = SubscriptionEventType("disconnected") Rejected SubscriptionEventType = SubscriptionEventType("rejected") Received SubscriptionEventType = SubscriptionEventType("received") )
type Subscriptions ¶
type Subscriptions struct {
// contains filtered or unexported fields
}
func (*Subscriptions) Create ¶
func (s *Subscriptions) Create(channelIdentifier *ChannelIdentifier) (*Subscription, error)
Click to show internal directories.
Click to hide internal directories.