The community forums are in BETA and closed to the public.

Calculating a PubNub Message Payload Size

See PubNub KB article, Calculating Message Payload Size Before Publish, for details.

Keep in mind that you'll want to ensure UTF-8 encoding on message before calculating the string length. On a mobile platform with keyboards that support multi-byte chars and unicode emoji, calculating payload size can be a bit challenging.

Yes agreed ensure your .length implementation allows UTF-8 character counting support.

And for C#:

var pubnub = new PubNub(your keys);

var messageSize = pubnub.JsonPluggableLibrary.SerializeToJsonString(message).Length * sizeof(Char);

Robert ty! Good for C#.


Login or Signup to post a comment