summaryrefslogtreecommitdiff
path: root/plugins/websockets
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-28 13:19:02 +0300
committerValery Piashchynski <[email protected]>2021-05-28 13:19:02 +0300
commit0a64bb2a71ddb6b0ee5861e255a20df1327aa099 (patch)
tree98a607f517706174215b92be8f337d21f918b955 /plugins/websockets
parent5527b31b2da2b60ed8877b8c43badb73f98ec7bb (diff)
- Tests for the ws-redis, ws-memory
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/websockets')
-rw-r--r--plugins/websockets/executor/executor.go2
-rw-r--r--plugins/websockets/rpc.go1
-rw-r--r--plugins/websockets/storage/storage.go2
3 files changed, 4 insertions, 1 deletions
diff --git a/plugins/websockets/executor/executor.go b/plugins/websockets/executor/executor.go
index 97293d52..1aa54be9 100644
--- a/plugins/websockets/executor/executor.go
+++ b/plugins/websockets/executor/executor.go
@@ -63,6 +63,7 @@ func (e *Executor) StartCommandLoop() error { //nolint:gocognit
switch msg.Command() {
// handle leave
case commands.Join:
+ e.log.Debug("get join command", "msg", msg)
// associate connection with topics
e.storage.InsertMany(e.connID, msg.Topics())
@@ -96,6 +97,7 @@ func (e *Executor) StartCommandLoop() error { //nolint:gocognit
// handle leave
case commands.Leave:
+ e.log.Debug("get leave command", "msg", msg)
// remove associated connections from the storage
e.storage.RemoveMany(e.connID, msg.Topics())
diff --git a/plugins/websockets/rpc.go b/plugins/websockets/rpc.go
index 2b3ae54e..f917bd53 100644
--- a/plugins/websockets/rpc.go
+++ b/plugins/websockets/rpc.go
@@ -14,6 +14,7 @@ type rpc struct {
func (r *rpc) Publish(msg []*pubsub.Msg, ok *bool) error {
const op = errors.Op("broadcast_publish")
+ r.log.Debug("message published", "msg", msg)
// publish to the registered broker
mi := make([]pubsub.Message, 0, len(msg))
diff --git a/plugins/websockets/storage/storage.go b/plugins/websockets/storage/storage.go
index 0557dee5..ac256be2 100644
--- a/plugins/websockets/storage/storage.go
+++ b/plugins/websockets/storage/storage.go
@@ -49,7 +49,7 @@ func (s *Storage) Remove(connID string, topic string) {
s.BST.Remove(connID, topic)
}
-// Thread safe get
+// GetByPtrTS Thread safe get
func (s *Storage) GetByPtrTS(topics []string, res map[string]struct{}) {
s.Lock()
defer s.Unlock()