added Notifier.Close()
This commit is contained in:
parent
3fd7ba0682
commit
5e1eaa73ed
@ -28,14 +28,17 @@ func (n *Notifier) Listen(then func(notification *Notification)) {
|
|||||||
func (n *Notifier) Notify(collection, type_ string, data []byte) {
|
func (n *Notifier) Notify(collection, type_ string, data []byte) {
|
||||||
n.channel <- &Notification{
|
n.channel <- &Notification{
|
||||||
Collection: collection,
|
Collection: collection,
|
||||||
Type: type_,
|
Type: type_,
|
||||||
Data:data,
|
Data: data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *Notifier) Close() {
|
||||||
|
close(n.channel)
|
||||||
|
}
|
||||||
|
|
||||||
type Notification struct {
|
type Notification struct {
|
||||||
Collection string `json:"collection"`
|
Collection string `json:"collection"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Data []byte `json:"data,omitempty"`
|
Data []byte `json:"data,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user