Comments (15)
Changed handler adressing, but still doesnt work for me.
public void Deserialize(byte[] rawMessage) {
Dictionary<MessagePackObject, MessagePackObject> mpoDict = MessagePackSerializer.Create<Dictionary<MessagePackObject, MessagePackObject>>().Unpack(new MemoryStream(rawMessage));
Dictionary<String, MessagePackObject> dict = mpoDict.ToDictionary(kv => (String)kv.Key, kv => kv.Value);
MessagePackObject theValue;
if (dict.TryGetValue("error", out theValue))
{
var error = (String)theValue;
}
else if (dict.TryGetValue("engine", out theValue))
{
var engine = (String)theValue;
if(engine.Equals("@LOGIN")){Server.Client.Handler.LoginHandler(dict)}
else if(engine.Equals("@REGISTER")){Server.Client.Handler.RegisterHandler(dict)}
else if(engine.Equals("@MESSAGE")){Server.Client.Handler.MessageHandler(dict)}
else if(engine.Equals("@LOGOUT")){Server.Client.Handler.LogoutHandler(dict)}
else{Server.Clinet.Handler.ErrorHandler.throwError("Unrecognized Engine")}
}
}
from msgpack-cli.
Could you use MessagePackObjectDictionary
to represents dynamic message? Its built-in serializer now can handle nested dynamic element, so it might solve your problem.
MessagePackObjectDictionary mpoDict = MessagePackSerializer.Create<MessagePackObjectDictionary>().Unpack(new MemoryStream(rawMessage));
// or, you can simply do as following:
// var mpoDict = Unpacking.UnpackDictionary(rawData).Value;
from msgpack-cli.
thanks for the fast reply :)
Seems to work for me :) but i dont really like the try and Error thing :(
from msgpack-cli.
Do you say that you want to ensure exact solution, or hope to improve documents in the first place? If former, please tell me expected & actual issue you faced. If latter, I will be happy if you told me what content did you like to see.
As a first step of latter, I updated wiki to publish sample codes.
from msgpack-cli.
Something like a package header would be awesome, so that the package destination can be instantly assigned and the payload transmitted to the class, which is working with it, so you can avoid the try&error stuff
from msgpack-cli.
I might misunderstand what the 'try&error' means. Do you mean that an ability to embed a kind of 'type hint' in the packed bytes to reduce hand-made detection of actual type like if
statements in your code?
from msgpack-cli.
yeah exactly all the if
statements are problematic. The app is managed with a massresponse servernetwork, but this network don't have unlimited CPU, too. So creating the dict, gettin one var of it, "try&error" it out, till you find what you are looking for or sorting it out, cause of malformed package.
from msgpack-cli.
Then transmit to the subengine, which evaluates the rest of the package etc. etc.
from msgpack-cli.
it would be more useful to have a so called package header, which don't need the creation of a dict and so on. So data can be evaluated in few less steps and cpu&RAM would be saved. I do not want to work with googlestuff but if you are interested in packageheaders, there is a extension called protobuf supporting exact these headers. Is it implementable here?
from msgpack-cli.
I see. I'll study the extension of protobuf and tuckle to dynamic type with existing msgpack ext
types.
from msgpack-cli.
nice. We would really like to use your Packageformat in our App :)
from msgpack-cli.
I've written the spec draft. Would you review it? https://gist.github.com/yfakariya/fb6d5c66fa4d8a82346b
from msgpack-cli.
Hey!
I am goin to take a detailed look on it tomorrow.
But i am very happy about to hear that you are still engaged.
CYU tomorrow
Am 11.01.2015 um 15:08 schrieb Yusuke Fujiwara:
@Jan-Heapster https://github.com/Jan-Heapster
I've written the spec draft. Would you review it?
https://gist.github.com/yfakariya/fb6d5c66fa4d8a82346b—
Reply to this email directly or view it on GitHub
#47 (comment).
Jan Weber / Backenddeveloper
[email protected] mailto:[email protected]/ + 49 1573 64 14 294
heapsterDev
http://www.invitu.de
from msgpack-cli.
@Jan-Heapster I released this feature in 0.6.0-beta2 release. Could you try it?
from msgpack-cli.
Fixed in 0.6.0.
from msgpack-cli.
Related Issues (20)
- Unpacker throws exception trying to read map length after IsMapHeader returns true HOT 1
- Buffering causes async unpacking to fail HOT 2
- Add a non-generic override to SerializerRepository
- EnumMemberAttribute does not work. (expectedly)
- Type Object in MessagePack HOT 1
- GetMemberName() causes NullReferenceException when using MessagePackSerializer.Get<T>() in Xamarin iOS
- [Unity][il2cpp]'class' is not registered in this resolver,resolver.StandardResolver HOT 2
- How to serialize and deserialize a List member in a class HOT 2
- Problem deserializing byte array - InvalidOperationException caused by Decoders.InvalidArrayHeader.Read call HOT 4
- about LZ4 HOT 1
- Unable to cast object of type on netcore HOT 1
- Custom Serialisation docs appear to be out of date. HOT 1
- PackAsync & UnpackAsync not working when passing data continuously using for loop c# HOT 1
- The unpacked value is not expected type HOT 2
- Authenticode Signing? HOT 2
- DateTime serialization and deserialization timezone HOT 3
- Enum Deserialization Not working? HOT 1
- Serializer.Unpack Continuosly Stream of Data => High Memory Usage HOT 3
- Serialization / deserialization speed optimizations HOT 2
- Serialization field order by declaration order HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msgpack-cli.