MCPcopy
hub / github.com/aceld/zinx / Send

Method Send

znet/ws_connection.go:349–363  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

347}
348
349func (c *WsConnection) Send(data []byte) error {
350 c.msgLock.Lock()
351 defer c.msgLock.Unlock()
352 if c.isClosed == true {
353 return errors.New("WsConnection closed when send msg")
354 }
355
356 err := c.conn.WriteMessage(websocket.BinaryMessage, data)
357 if err != nil {
358 zlog.Ins().ErrorF("SendMsg err data = %+v, err = %+v", data, err)
359 return err
360 }
361
362 return nil
363}
364
365func (c *WsConnection) SendToQueue(data []byte, opts ...ziface.MsgSendOption) error {
366 c.msgLock.Lock()

Callers 1

StartWriterMethod · 0.95

Calls 2

InsFunction · 0.92
ErrorFMethod · 0.65

Tested by

no test coverage detected