Message

public class Message

Represents an EventBus message with metadata.

  • The body (content) of the message.

    Declaration

    Swift

    public var body: JSON
  • True if this message was the result of a send (vs. publish)

    Declaration

    Swift

    public var isSend: Bool
  • Sends back a reply to this message

    Throws

    EventBus.Error.invalidData(data:) if the given body can’t be converted to JSON

    Throws

    EventBus.Error.disconnected(cause:) if not connected to the remote bridge

    Declaration

    Swift

    public func reply(body: [String: Any],
                          headers: [String: String]? = nil,
                          replyTimeout: Int = 30000, // 30 seconds
                          callback: ((Response) -> ())? = nil) throws

    Parameters

    body

    the content of the message

    headers

    headers to send with the message (default: [String: String]())

    replyTimeout

    the timeout (in ms) to wait for a reply if a reply callback is provided (default: 30000)

    callback

    the callback to handle the reply or timeout Response (default: nil)