Message

An object that encapsulates a $(ZMQ) message.

This struct is a wrapper around a zmq_msg_t object. Unlike Context and Socket, it does not perform reference counting, because $(ZMQ) messages have a form of reference counting of their own. A Message cannot be copied by normal assignment; use Message.copy for this.

A default-initialized Message is not a valid $(ZMQ) message; it must always be explicitly initialized with _Message.opCall or _Message.this:

Message msg1;               // Invalid message
auto msg2 = Message();      // Empty message
auto msg3 = Message(1024);  // 1K message

When a Message goes out of scope, $(ZMQREF zmq_msg_close()) is called on the underlying zmq_msg_t.

Constructors

this
this(size_t size)

Initialises a $(ZMQ) message of a specified size.

Destructor

~this
~this()

Releases the $(ZMQ) message when the Message is destroyed.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

close
void close()

Releases the $(ZMQ) message.

copy
Message copy()
copyTo
void copyTo(Message dest)

Copies message content to another message.

move
Message move()
moveTo
void moveTo(Message dest)

Moves message content to another message.

Properties

data
ubyte[] data [@property getter]

Retrieves the message content.

handle
inout(zmq_msg_t)* handle [@property getter]

A pointer to the underlying zmq_msg_t.

more
bool more [@property getter]

Whether there are more message parts to retrieve.

size
size_t size [@property getter]

The message content size in bytes.

Static functions

opCall
Message opCall()

Initialises an empty $(ZMQ) message.

Meta