diff --git a/api/types/auth_webhook.go b/api/types/auth_webhook.go index deb643c42..841e672f4 100644 --- a/api/types/auth_webhook.go +++ b/api/types/auth_webhook.go @@ -50,16 +50,14 @@ type Method string // Belows are the names of RPCs. const ( - ActivateClient Method = "ActivateClient" - DeactivateClient Method = "DeactivateClient" - AttachDocument Method = "AttachDocument" - DetachDocument Method = "DetachDocument" - RemoveDocument Method = "RemoveDocument" - PushPull Method = "PushPull" - WatchDocuments Method = "WatchDocuments" - Broadcast Method = "Broadcast" - SubscribeBroadcastEvent Method = "SubscribeBroadcastEvent" - UnsubscribeBroadcastEvent Method = "UnsubscribeBroadcastEvent" + ActivateClient Method = "ActivateClient" + DeactivateClient Method = "DeactivateClient" + AttachDocument Method = "AttachDocument" + DetachDocument Method = "DetachDocument" + RemoveDocument Method = "RemoveDocument" + PushPull Method = "PushPull" + WatchDocuments Method = "WatchDocuments" + Broadcast Method = "Broadcast" ) // IsAuthMethod returns whether the given method can be used for authorization. @@ -83,8 +81,6 @@ func AuthMethods() []Method { PushPull, WatchDocuments, Broadcast, - SubscribeBroadcastEvent, - UnsubscribeBroadcastEvent, } } diff --git a/client/client.go b/client/client.go index b03346fc5..02fc37238 100644 --- a/client/client.go +++ b/client/client.go @@ -464,7 +464,7 @@ func (c *Client) Watch( go func() { for { select { - case e := <-doc.DocEvents(): + case e := <-doc.Events(): t := PresenceChanged if e.Type == document.WatchedEvent { t = DocumentWatched diff --git a/pkg/document/document.go b/pkg/document/document.go index a68954610..f368aa7c6 100644 --- a/pkg/document/document.go +++ b/pkg/document/document.go @@ -85,8 +85,8 @@ type Document struct { // is used to protect `doc.presences`. clonePresences *innerpresence.Map - // docEvents is the channel to send events that occurred in the document. - docEvents chan DocEvent + // events is the channel to send events that occurred in the document. + events chan DocEvent // broadcastRequests is the send-only channel to send broadcast requests. broadcastRequests chan BroadcastRequest @@ -104,7 +104,7 @@ type Document struct { func New(key key.Key) *Document { return &Document{ doc: NewInternalDocument(key), - docEvents: make(chan DocEvent, 1), + events: make(chan DocEvent, 1), broadcastRequests: make(chan BroadcastRequest, 1), broadcastResponses: make(chan error, 1), broadcastEventHandlers: make(map[string]func( @@ -181,7 +181,7 @@ func (d *Document) ApplyChangePack(pack *change.Pack) error { } for _, e := range events { - d.docEvents <- e + d.events <- e } } @@ -360,9 +360,9 @@ func (d *Document) RemoveOnlineClient(clientID string) { d.doc.RemoveOnlineClient(clientID) } -// DocEvents returns the document events of this document. -func (d *Document) DocEvents() <-chan DocEvent { - return d.docEvents +// Events returns the document events of this document. +func (d *Document) Events() <-chan DocEvent { + return d.events } // BroadcastRequests returns the broadcast requests of this document.