message body를 any로 변경
This commit is contained in:
@ -31,13 +31,13 @@ type UpstreamMessage struct {
|
||||
Alias string
|
||||
Accid primitive.ObjectID
|
||||
Target string
|
||||
Body []byte
|
||||
Body any
|
||||
Tag []string
|
||||
}
|
||||
|
||||
type DownstreamMessage struct {
|
||||
Alias string `json:",omitempty"`
|
||||
Body string `json:",omitempty"`
|
||||
Body any `json:",omitempty"`
|
||||
Tag []string `json:",omitempty"`
|
||||
}
|
||||
|
||||
@ -314,7 +314,13 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
|
||||
conn := entireConns[accid]
|
||||
if conn != nil {
|
||||
// 이 경우 아니면 publish 해야 함
|
||||
conn.WriteMessage(websocket.TextMessage, usermsg.Body)
|
||||
ds, _ := json.Marshal(DownstreamMessage{
|
||||
Alias: usermsg.Alias,
|
||||
Body: usermsg.Body,
|
||||
Tag: usermsg.Tag,
|
||||
})
|
||||
|
||||
conn.WriteMessage(websocket.TextMessage, ds)
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -370,7 +376,12 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
|
||||
accid := target[1:]
|
||||
conn := entireConns[accid]
|
||||
if conn != nil {
|
||||
conn.WriteMessage(websocket.TextMessage, usermsg.Body)
|
||||
ds, _ := json.Marshal(DownstreamMessage{
|
||||
Alias: usermsg.Alias,
|
||||
Body: usermsg.Body,
|
||||
Tag: usermsg.Tag,
|
||||
})
|
||||
conn.WriteMessage(websocket.TextMessage, ds)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user