(data []byte)
| 347 | } |
| 348 | |
| 349 | func (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 | |
| 365 | func (c *WsConnection) SendToQueue(data []byte, opts ...ziface.MsgSendOption) error { |
| 366 | c.msgLock.Lock() |
no test coverage detected