* 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 удалений

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

@@ -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)