public void SendC2S(Proto.C2S c2s) { var stream = new System.IO.MemoryStream(); ProtoBuf.Serializer.Serialize(stream, c2s); ws.Send(stream.ToArray()); }
private void OnOpen(object sender, EventArgs e) { Debug.Log("websocket connect ok"); var c2s = new Proto.C2S(); var pb = new Proto.GamerLoginC2S(); pb.id = this.id; pb.session = this.session; c2s.gamerLoginC2S = pb; SendC2S(c2s); }
private IEnumerator CoHeart() { yield return(new WaitForSeconds(10)); var c2s = new Proto.C2S(); var pb = new Proto.ServerTimeC2S(); pb.id = this.id; c2s.serverTimeC2S = pb; SendC2S(c2s); }