ClientMessageDelegate

public protocol ClientMessageDelegate : AnyObject

Protocol to be implemented to receive LightstreamerClient.sendMessage(_:withSequence:timeout:delegate:enqueueWhileDisconnected:) events reporting a message processing outcome.

Events for these delegates are dispatched by a different thread than the one that generates them. All the notifications for a single LightstreamerClient, including notifications to ClientDelegate, SubscriptionDelegate, ClientMessageDelegate, MPNDeviceDelegate and MPNSubscriptionDelegate, will be dispatched by the same thread. Only one event per message is fired on this delegate.

  • Event handler that is called by Lightstreamer when any notifications of the processing outcome of the related message haven’t been received yet and can no longer be received.

    Typically, this happens after the session has been closed. In this case, the client has no way of knowing the processing outcome and any outcome is possible.

    Declaration

    Swift

    func client(_ client: LightstreamerClient, didAbortMessage originalMessage: String, sentOnNetwork: Bool)

    Parameters

    client

    The LightstreamerClient instance.

    originalMessage

    The message to which this notification is related.

    sentOnNetwork

    true if the message was sent on the network, false otherwise. Even if the flag is true, it is not possible to infer whether the message actually reached the Lightstreamer Server or not.

  • Event handler that is called by Lightstreamer when the related message has been processed by the Server but the expected processing outcome could not be achieved for any reason.

    Declaration

    Swift

    func client(_ client: LightstreamerClient, didDenyMessage originalMessage: String, withCode code: Int, error: String)

    Parameters

    client

    The LightstreamerClient instance.

    originalMessage

    The message to which this notification is related.

    code

    The error code sent by the Server. The code value is dependent on the specific Metadata Adapter implementation.

    error

    The description of the error sent by the Server.

  • Event handler that is called by Lightstreamer to notify that the related message has been discarded by the Server.

    This means that the message has not reached the Metadata Adapter and the message next in the sequence is considered enabled for processing.

    Declaration

    Swift

    func client(_ client: LightstreamerClient, didDiscardMessage originalMessage: String)

    Parameters

    client

    The LightstreamerClient instance.

    originalMessage

    The message to which this notification is related.

  • Event handler that is called by Lightstreamer when the related message has been processed by the Server but the processing has failed for any reason.

    The level of completion of the processing by the Metadata Adapter cannot be determined.

    Declaration

    Swift

    func client(_ client: LightstreamerClient, didFailMessage originalMessage: String)

    Parameters

    client

    The LightstreamerClient instance.

    originalMessage

    The message to which this notification is related.

  • Event handler that is called by Lightstreamer when the related message has been processed by the Server with success.

    Declaration

    Swift

    func client(_ client: LightstreamerClient, didProcessMessage originalMessage: String, withResponse response: String)

    Parameters

    client

    The LightstreamerClient instance.

    originalMessage

    The message to which this notification is related.

    response

    The response from the Metadata Adapter. If not supplied (i.e. supplied as nil), an empty message is received here.