MessagePack

How to invoke client's callback at server end?

和自甴很熟 提交于 2019-12-13 07:27:48
问题 RPC do things like this: server define a function foo_max(para) client call foo_max, send 'max+para' server get 'max' and call foo_max(para) server send return val client get result and return But this way is not flexible because I must define all functions at server end. My case is that I want to support user-defined callback function at client end, so how can I call the client's callback funciton at server end? Thanks 来源: https://stackoverflow.com/questions/19740380/how-to-invoke-clients

In messagepack, error while getting value from MapValue.. Please help me

血红的双手。 提交于 2019-12-11 03:08:59
问题 I'm trying to serialize map using messagpack.write(map) . During deserialization using messagepack.read(byte[]) i got MapValue . But I cannot fetch the values using MapValue.get(key) . Look this problem below HashMap<Object,Object> map = new HashMap<Object, Object>(); map.put(1,"ONE"); map.put("ONE","TWO"); MessagePack m= new MessagePack(); byte[] b = m.write(map); MessagePack m1 = new MessagePack(); MapValue value = (MapValue)m1.read(b); System.out.println(value);// here I am getting {1:"ONE

How to use MessagePack in C#?

允我心安 提交于 2019-12-10 13:57:38
问题 I read the msgpack-cli quick start documentation. I also got the C# (CLI) NuGet package (v0.3). None of the classes (eg BoxingPacker , CompiledPacker or ObjectPacker ) mentioned in the official documentation exist in the NuGet package (!!). I'm presuming the documentation has been orphaned. So does anyone have examples how to serialize/deserialize to/from MessagePack within C#? I'm trying to do this for an object and am interested in the binary nature of the serializer. 回答1: To future readers

Storing a MessagePacked hash in Redis

亡梦爱人 提交于 2019-12-07 05:23:49
问题 I'm having a problem storing a MessagePacked hash in Redis. I've pasted a test case below. When pulling out the packed data from Redis and unpacking it, the hash is slightly corrupted. This appears to happen when the hash values are beyond a certain length, although I can't say that for sure. I'm using Redis 2.4.17 (default config), Ruby 1.9.3p194, MessagePack 0.4.7, and the Redis gem 3.0.2. The same problem happens using node, so I'm assuming the problem is within MessagePack or Redis. Any

MessagePack C API

◇◆丶佛笑我妖孽 提交于 2019-12-06 16:03:02
问题 In looking at the C API for MessagePack, there are a number of functions to appropriately serialize (pack) the data according to type: msgpack_pack_uint8 , msgpack_pack_int32 , ... There doesn't seem to be the equivalent call in the API to unpack the data. msgpack_unpack_next returns a msgpack_object . These objects only have coarse granularity of types (the largest of the type: int64, double, ...), based on the enums included. Am I missing something here? Is the expectation that the coarse

Storing a MessagePacked hash in Redis

送分小仙女□ 提交于 2019-12-05 10:45:09
I'm having a problem storing a MessagePacked hash in Redis. I've pasted a test case below. When pulling out the packed data from Redis and unpacking it, the hash is slightly corrupted. This appears to happen when the hash values are beyond a certain length, although I can't say that for sure. I'm using Redis 2.4.17 (default config), Ruby 1.9.3p194, MessagePack 0.4.7, and the Redis gem 3.0.2. The same problem happens using node, so I'm assuming the problem is within MessagePack or Redis. Any ideas? require 'redis' require 'msgpack' class Test def self.run(url) redis = Redis.new data = {'number'

MessagePack C API

人盡茶涼 提交于 2019-12-04 20:20:11
In looking at the C API for MessagePack, there are a number of functions to appropriately serialize (pack) the data according to type: msgpack_pack_uint8 , msgpack_pack_int32 , ... There doesn't seem to be the equivalent call in the API to unpack the data. msgpack_unpack_next returns a msgpack_object . These objects only have coarse granularity of types (the largest of the type: int64, double, ...), based on the enums included. Am I missing something here? Is the expectation that the coarse object be used and then cast? How should unpacking be done properly? Furthermore, is there any good

MessagePack: fast cross-platform serializer and RPC - please share experience

别等时光非礼了梦想. 提交于 2019-12-02 23:23:28
Looking for some fast, simple and stable RPC library I stumbled upon MessagePack project which seems to be very good. It is also under active development. If you used it in any way, could you please share your experience? P.S. I think this question should be community wiki Well, after some time I found that MessagePack is not well-documented (there was even non-working tutorial in Wiki for Java), there are like 7 outstanding bugs several months old without any replies. Code even is not JavaDoc'ed so that you can take and learn it quickly... But it seems developer activity there is quite high

.net core 3.0 Signalr - 03 使用MessagePack压缩传输内容

匿名 (未验证) 提交于 2019-12-02 22:09:29
## MessagePack基础介绍 Signalr默认使用的是json形式传递数据,但是signalr提供了灵活的扩展,支持MessagePack形式序列化数据,以增加性能降低网络传输的效果,极大的提高响应速度。 先看一个MessagePack自定义序列化的例子,以一个自定义的实体对象为例,可以使用MessagepackObject标记为序列化的对象,同时定义使用属性名作为key(区分大小写),同时可以定义忽略某个属性等、以及自定义key等 ``` C# [MessagePackObject(keyAsPropertyName: true)] public class OffLineData { /// /// 用户Id /// public string UserId { set; get; } /// /// 连接Id /// public string ConnectionId { set; get; } /// /// 是否该用户的最后一个连接 /// public bool IsLast { set; get; } [IgnoreMember] public string Test { set;get;} } // 比如对象,new OffLineData(){UserId="1000",ConnectionId="AZDEFASDFASDF",IsLast:true

Comparing null-terminated string with a non null-terminated string in C

早过忘川 提交于 2019-12-02 07:19:03
问题 The deserialization library (messagepack) I am using does not provide null-terminated strings. Instead, I get a pointer to the beginning of the string and a length. What is the fastest way to compare this string to a normal null-terminated string? 回答1: The fastest way is strncmp() which limits the length to be compared. if (strncmp(sa, sb, length)==0) ... This assumes however that the length you use is the maximum length of the two strings. If the null terminated string could have a bigger