mirror of
https://github.com/gl-inet/glkvm-cloud.git
synced 2026-09-24 03:26:25 +00:00
perf: optimize JSON message construction using fmt.Appendf
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
@@ -254,7 +254,7 @@ func (br *broker) run() {
|
||||
case msgTypeFileSend:
|
||||
pipereader, pipewriter := io.Pipe()
|
||||
br.fileProxy.Store(sid, &fileProxy{pipereader, pipewriter})
|
||||
s.user.WriteMsg(websocket.TextMessage, []byte(fmt.Sprintf(`{"type":"sendfile", "name": "%s"}`, string(data))))
|
||||
s.user.WriteMsg(websocket.TextMessage, fmt.Appendf(nil, `{"type":"sendfile", "name": "%s"}`, string(data)))
|
||||
|
||||
case msgTypeFileRecv:
|
||||
s.user.WriteMsg(websocket.TextMessage, []byte(`{"type":"recvfile"}`))
|
||||
|
||||
Reference in New Issue
Block a user