summaryrefslogtreecommitdiff
path: root/plugins/websockets/executor/executor.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-27 13:38:51 +0300
committerValery Piashchynski <[email protected]>2021-05-27 13:38:51 +0300
commit1c7c79ffc50721f586c582356d04fd826fc74811 (patch)
treed8207a4c8332dc83780809b5c689278afa5907a2 /plugins/websockets/executor/executor.go
parent34df1626822613004d0974474c8bbe10cf2f1a94 (diff)
- Add more documetation
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/websockets/executor/executor.go')
-rw-r--r--plugins/websockets/executor/executor.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/websockets/executor/executor.go b/plugins/websockets/executor/executor.go
index 9ef5e40a..048a41ed 100644
--- a/plugins/websockets/executor/executor.go
+++ b/plugins/websockets/executor/executor.go
@@ -3,6 +3,7 @@ package executor
import (
"github.com/fasthttp/websocket"
json "github.com/json-iterator/go"
+ "github.com/spiral/errors"
"github.com/spiral/roadrunner/v2/pkg/pubsub"
"github.com/spiral/roadrunner/v2/plugins/logger"
"github.com/spiral/roadrunner/v2/plugins/websockets/commands"
@@ -22,6 +23,8 @@ type Executor struct {
// associated connection ID
connID string
+
+ // map with the pubsub drivers
pubsub map[string]pubsub.PubSub
}
@@ -37,14 +40,16 @@ func NewExecutor(conn *connection.Connection, log logger.Logger, bst *storage.St
}
func (e *Executor) StartCommandLoop() error {
+ const op = errors.Op("executor_command_loop")
for {
mt, data, err := e.conn.Read()
if err != nil {
if mt == -1 {
- return err
+ e.log.Error("socket was closed", "error", err, "message type", mt)
+ return nil
}
- return err
+ return errors.E(op, err)
}
msg := &pubsub.Msg{}