dartzmq 1.0.0-dev.7 copy "dartzmq: ^1.0.0-dev.7" to clipboard
dartzmq: ^1.0.0-dev.7 copied to clipboard

outdated

A simple dart zeromq implementation/wrapper around the libzmq C++ library

dartzmq #

A simple dart zeromq implementation/wrapper around the libzmq C++ library

Features #

Currently supported:

  • Creating sockets (pair, pub, sub, req, rep, dealer, router, pull, push, xPub, xSub, stream)
  • Sending messages (of type List<int>)
  • Bind (bind(String address))
  • Connect (connect(String address))
  • Curve (setCurvePublicKey(String key), setCurveSecretKey(String key) and setCurveServerKey(String key))
  • Socket options (setOption(int option, String value))
  • Receiving multipart messages (ZMessage)
  • Topic subscription for sub sockets (subscribe(String topic) & unsubscribe(String topic))

Getting started #

Currently only windows is officially supported as a platform, but it depends on the used shared library of libzmq. I have tested this on windows, which works. Other platforms have not been tested, but should work. If you have tested this plugin on another platform and got it to work, please share your findings and create an issue to add it to the list.

Windows #

Place a shared library of libzmq next to your executable (for example place libzmq-v142-mt-4_3_5.dll in the folder yourproject/build/windows/runner/Debug/)

Note that in order for this plugin to work you will need to either get a shared library of libzmq or compile it yourself. Especially when using this on windows you need to make sure that libzmq is compiled using MSVC-2019 if you are using clang it will not work (more info)

Android #

Android has not been fully tested, but essentially you can follow these steps, which will get you a libzmq.so. Which you need to include in your project following these steps

Usage #

Create context

final ZContext context = ZContext();

Create socket

final ZSocket socket = context.createSocket(SocketType.req);

Connect socket

socket.connect("tcp://localhost:5566");

Send message

socket.send([1, 2, 3, 4, 5]);

Receive ZMessages

_socket.messages.listen((message) {
    // Do something with message
});

Receive ZFrames

_socket.frames.listen((frame) {
    // Do something with frame
});

Receive payloads (Uint8List)

_socket.payloads.listen((payload) {
    // Do something with payload
});

Destroy socket

socket.close();

Destroy context

context.stop();

Additional information #

TODO: Tell users more about the package: where to find more information, how to contribute to the package, how to file issues, what response they can expect from the package authors, and more.

14
likes
0
pub points
77%
popularity

Publisher

verified publisherwirmo.de

A simple dart zeromq implementation/wrapper around the libzmq C++ library

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi, flutter

More

Packages that depend on dartzmq