IEnumerator MsgTest() { string url = "msg_test"; // テストデータ var sendData = new RecvMsg(); sendData.Id = 12345; sendData.AddScore = -9876; sendData.Text = "hoge"; Dictionary <string, string> headers = new Dictionary <string, string>(); headers["Content-Type"] = "application/x-msgpack"; var packer = new MsgPack.ObjectPacker(); byte[] body = packer.Pack(sendData); using (WWW www = new WWW(HOST + url, body, headers)) { yield return(www); if (!string.IsNullOrEmpty(www.error)) { Debug.Log("error:" + www.error); yield break; } var unpacker = new MsgPack.ObjectPacker(); // unpack var result = unpacker.Unpack <RecvMsg>(www.bytes); Debug.Log("id : " + result.Id + " score : " + result.AddScore + " text : " + result.Text); } }
private static object XorFloatUnpacker(ObjectPacker packer, MsgPackReader reader) { return(new XorFloat((float)packer.Unpack(reader, typeof(float)))); }
private static object XorUIntUnpacker(ObjectPacker packer, MsgPackReader reader) { return(new XorUInt((uint)packer.Unpack(reader, typeof(uint)))); }