* Add plugin websocket hooks

* Improve sending message mechanism and filter out of the router plugin specific messages

* Return and manage error if the request clone fails

* Wording change to avoid repetition

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Miguel de la Cruz
2021-08-24 10:11:31 +02:00
коммит произвёл GitHub
родитель b66fd1f89e
Коммит 0ae681464e
5 изменённых файлов: 242 добавлений и 23 удалений

Просмотреть файл

@@ -168,3 +168,21 @@ func (hooks *hooksTimerLayer) OnPluginClusterEvent(c *Context, ev model.PluginCl
hooks.hooksImpl.OnPluginClusterEvent(c, ev)
hooks.recordTime(startTime, "OnPluginClusterEvent", true)
}
func (hooks *hooksTimerLayer) OnWebSocketConnect(webConnID, userID string) {
startTime := timePkg.Now()
hooks.hooksImpl.OnWebSocketConnect(webConnID, userID)
hooks.recordTime(startTime, "OnWebSocketConnect", true)
}
func (hooks *hooksTimerLayer) OnWebSocketDisconnect(webConnID, userID string) {
startTime := timePkg.Now()
hooks.hooksImpl.OnWebSocketDisconnect(webConnID, userID)
hooks.recordTime(startTime, "OnWebSocketDisconnect", true)
}
func (hooks *hooksTimerLayer) WebSocketMessageHasBeenPosted(webConnID, userID string, req *model.WebSocketRequest) {
startTime := timePkg.Now()
hooks.hooksImpl.WebSocketMessageHasBeenPosted(webConnID, userID, req)
hooks.recordTime(startTime, "WebSocketMessageHasBeenPosted", true)
}