1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

websocket private functions

This commit is contained in:
Chen-I Lim 2021-02-02 13:00:22 -08:00
parent 58c967bf53
commit a56cf03e0c

View File

@ -152,7 +152,7 @@ func (ws *Server) authenticateListener(wsSession *websocketSession, token string
log.Printf("authenticateListener: Authenticated")
}
// AddListener adds a listener for a block's change.
// addListener adds a listener for a block's change.
func (ws *Server) addListener(wsSession *websocketSession, blockIDs []string) {
if !wsSession.isAuthenticated {
log.Printf("addListener: NOT AUTHENTICATED")
@ -217,8 +217,8 @@ func (ws *Server) removeListenerFromBlocks(wsSession *websocketSession, blockIDs
ws.mu.Unlock()
}
// GetListeners returns the listeners to a blockID's changes.
func (ws *Server) GetListeners(blockID string) []*websocket.Conn {
// getListeners returns the listeners to a blockID's changes.
func (ws *Server) getListeners(blockID string) []*websocket.Conn {
ws.mu.Lock()
listeners := ws.listeners[blockID]
ws.mu.Unlock()
@ -243,7 +243,7 @@ func (ws *Server) BroadcastBlockChange(block model.Block) {
blockIDsToNotify := []string{block.ID, block.ParentID}
for _, blockID := range blockIDsToNotify {
listeners := ws.GetListeners(blockID)
listeners := ws.getListeners(blockID)
log.Printf("%d listener(s) for blockID: %s", len(listeners), blockID)
if listeners != nil {