tobias / vertx-swift-eventbus

Lib for using the Vert.x TCP EventBus bridge from Swift
Apache License 2.0
5 stars 2 forks source link

How much data can I send through event bus? #8

Closed varunkudalkar closed 6 years ago

varunkudalkar commented 6 years ago

I am using this client in my iOS application and when I publish JSON object: {"id": 1, "secId": 2, "userId": 5, "msg": "0", "session" : "d0dab4fe26e52b745ea430d9c24345a6575a844de478b8db41cb30fc6bde23dd" } I'm receiving an error as "Fatal error: Not enough bits to represent a signed value" and application crashes. And when I remove "session" parameter then object sent without any problem. Any solution? update1: crashing in Util.swift file, at line number 38 --> bytes.append(UInt8(value >> Int32(x * 8))) update2: We can only send 256 bytes of data as we have used UInt8 to convert JSON string to bytes, can we increase this limit?

varunkudalkar commented 6 years ago

Resolved the issue by implementing another UInt8 initializer as follows UInt8(truncatingIfNeeded: value >> Int32(x * 8)) A big thanks to @garrialmighty.