DDPEvents

public struct DDPEvents

DDPEvents is a struct holder for callback closures that execute in response to websocket and Meteor lifecyle events. New closures can be assigned to public closures to modify the clients behavior in response to the trigger event.

  • Undocumented

    Declaration

    Swift

    public struct DDPEvents
  • onDisconnected executes when the client is disconnected

    Declaration

    Swift

    public var onDisconnected:      () -> () = {log.debug("disconnected")}
  • onFailed executes when an attempt to make a DDP connection fails

    Declaration

    Swift

    public var onFailed:            () -> () = {log.error("failed")}
  • onAdded executes when a document has been added to a local collection

    Declaration

    Swift

    public var onAdded:             ((collection:String, id:String, fields:NSDictionary?) -> ())?

    Parameters

    collection

    the string name of the collection to which the document belongs

    id

    the string unique id that identifies the document on the server

    fields

    an optional NSDictionary with the documents properties

  • onChanged executes when the server sends an instruction to modify a local document

    Declaration

    Swift

    public var onChanged:           ((collection:String, id:String, fields:NSDictionary?, cleared:NSArray?) -> ())?

    Parameters

    collection

    the string name of the collection to which the document belongs

    id

    the string unique id that identifies the document on the server

    fields

    an optional NSDictionary with the documents properties

    cleared

    an optional array of string property names to delete

  • onRemoved executes when the server sends an instruction to remove a document from the local collection

    Declaration

    Swift

    public var onRemoved:           ((collection:String, id:String) -> ())?

    Parameters

    collection

    the string name of the collection to which the document belongs

    id

    the string unique id that identifies the document on the server

  • onUpdated executes when the server sends a notification that all the consequences of a method call have been communicated to the client

    Declaration

    Swift

    public var onUpdated:           ((methods: [String]) -> ())?

    Parameters

    methods

    An array of method id strings

  • onError executes when the client receives a DDP error message

    Declaration

    Swift

    public var onError:             ((message:DDPError) -> ())?

    Parameters

    message

    A DDPError message describing the error