Skip to content

Commit 182b6e8

Browse files
committed
Add scopes marshaller to websocket
1 parent edbcf72 commit 182b6e8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

internal/websocket/hub/session.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
gsw "github.com/gorilla/websocket"
77
"github.com/joinimpact/api/internal/websocket"
8+
"github.com/joinimpact/api/pkg/scopes"
89
)
910

1011
// SessionID is an int64 ID reference to one session/user
@@ -29,8 +30,10 @@ func (s *Session) SendMessage(message websocket.Message) error {
2930
message.SequenceNumber = s.SequenceNumber
3031
s.SequenceNumber++
3132

33+
marshaled := scopes.Marshal(scopes.ScopeAuthenticated, message)
34+
3235
// Push the message to the channel
33-
s.Channel <- message
36+
s.Channel <- marshaled
3437
return nil
3538
}
3639

server

16.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)