enwi / dartzmq

A simple dart zeromq implementation/wrapper around the libzmq C++ library
https://pub.dev/documentation/dartzmq/latest/
MIT License
26 stars 17 forks source link

send non-binary data #2

Closed NaarGes closed 2 years ago

NaarGes commented 2 years ago

Hi, why socket.send() parameter is from List<int> type? does it get data as binary array? what if someone wants to send data non-binary?

and I have another question; how we can receive response from a req socket connection?

enwi commented 2 years ago

Hi, why socket.send() parameter is from List type? does it get data as binary array?

Hey @NaarGes the List<int> is treated as a binary array. I choose it for ease of use for example when using protobuf to serialize/deserialize data, because they use an Uint8List which just implements a List<int>.

what if someone wants to send data non-binary?

If you want to send non-binary data you need to use some kind of serialization/deserialization mechanism like protobuf.

how we can receive response from a req socket connection?

Just use the Streams of ZSocket one of messages, frames or payloads

enwi commented 2 years ago

I updated the README and example to show how to receive messages

enwi commented 2 years ago

Has this question been resolved for you @NaarGes ?

NaarGes commented 2 years ago

Actually I implement it bud I couldn't use it for my flutter application, It gets libzmq.so not found error (or sth like that) in runtime. I tried adding libzmq.so in my project using your hints from [#1 ] but still couldn't fix that error. So because I have time limits, I switched using jeromq itself in Kotlin through MethodChannel and EventChannel in flutter.

enwi commented 2 years ago

Yeah getting it to work on Android is a little more difficult than on windows. For Android a compiled version of the standard c++ library is needed as well. I will need to add that to the documentation!

NaarGes commented 2 years ago

It's a very useful and unique package for dart. Keep it on! good luck

enwi commented 2 years ago

I've updated the README and improved the steps for Android