Add plugin websocket hooks (#18151)
* 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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b66fd1f89e
Коммит
0ae681464e
@@ -28,6 +28,19 @@ func (o *WebSocketRequest) ToJson() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func (o *WebSocketRequest) Clone() (*WebSocketRequest, error) {
|
||||
buf, err := json.Marshal(o)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var ret WebSocketRequest
|
||||
err = json.Unmarshal(buf, &ret)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
|
||||
func WebSocketRequestFromJson(data io.Reader) *WebSocketRequest {
|
||||
var o *WebSocketRequest
|
||||
json.NewDecoder(data).Decode(&o)
|
||||
|
||||
Ссылка в новой задаче
Block a user