Documentation
¶
Overview ¶
Package pubsubch supplements the pubsub package found in the radix suite. This one has the ability to receive incomming publishes over a channel. This channel will be close()'d when the connection is closed.
The methods on the PubSubCh object should only ever be used syncronously. However, the PublishCh, where publishes are pushed to, *should* be read from asyncronously. Any blocking on it may block the whole object.
See the example for a good example of how to use this package
Index ¶
- Constants
- type PubSubCh
- func (p *PubSubCh) Close() error
- func (p *PubSubCh) PSubscribe(pattern ...string) (int64, error)
- func (p *PubSubCh) PUnsubscribe(pattern ...string) (int64, error)
- func (p *PubSubCh) Ping() error
- func (p *PubSubCh) Subscribe(channel ...string) (int64, error)
- func (p *PubSubCh) Unsubscribe(channel ...string) (int64, error)
- type Publish
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the default read/write timeout used on the tcp socket
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PubSubCh ¶
type PubSubCh struct { // Channel which publishes from channels this connection is subscribed to // will be pushed onto. Not reading from this will cause the connection // routine to be blocked. This is the only part of PubSubCh which can be // interacted with in a different go-routine from the rest. It will be // close()'d when the connection is closed PublishCh chan *Publish // contains filtered or unexported fields }
PubSubCh is a container for the channeled pubsub connection. All methods should be called syncronously, however the PublishCh can (and should) be read from asyncronously.
func DialTimeout ¶
DialTimeout creates a new PubSubCh with the given timeout. That timeout will be used when reading and writing to the underlying connection
func (*PubSubCh) Close ¶
Close closes the connection. No methods should be called after this is called. This will cause the PublishCh to close
func (*PubSubCh) PSubscribe ¶
PSubscribe is like Subscribe but it takes in a set of patterns instead of channel names
func (*PubSubCh) PUnsubscribe ¶
PUnsubscribe is like Unsubscribe but it takes in a set of patterns instead of channel names
You *must* provide at least one pattern here, the empty argument form of the command does not work with this package
func (*PubSubCh) Ping ¶
Ping calls the PING command on the connection. This will only return an error if the connection has been closed