public void Send() { if (m_scoket.state == WebSocket.State.Connected) { m_scoket.Send(SimpleMessagePackTool.Pack(message.text)); } }
public void OnReceived(byte[] data) { /* * Cause of the message receive in the network thread * so we should cached the message here. * suggest use message queue to cached the message * we just simple cached. * 这里因为多线程原因 要在网络线程里缓存接收到的数据 * 此处只做简单处理 建议使用消息队列 */ m_currentReceiveStr += "\n" + SimpleMessagePackTool.Unpack(data); }