html escape 비활성화

This commit is contained in:
2023-08-02 16:21:34 +09:00
parent b501160efc
commit f6441a9b4c

View File

@ -1,6 +1,7 @@
package wshandler
import (
"bytes"
"context"
"encoding/json"
@ -84,13 +85,17 @@ func (r *room) loop(ctx context.Context, conns *map[string]*wsconn) (normalEnd b
Body: msg.Body,
Tag: append(msg.Tag, tag),
}
bt, _ := json.Marshal(ds)
buff := new(bytes.Buffer)
enc := json.NewEncoder(buff)
enc.SetEscapeHTML(false)
enc.Encode(ds)
for _, conn := range *conns {
r.sendMsgChan <- send_msg_queue_elem{
to: conn,
mt: websocket.TextMessage,
msg: bt,
msg: buff.Bytes(),
}
}
}