Deadpan-DDP-0.9.6.0: Write clients for Meteor's DDP Protocol

Safe HaskellNone
LanguageHaskell2010

Web.DDP.Deadpan.Callbacks

Description

This module is intended to provide a set of callbacks for various server events.

The set of callbacks provided fulfills the functionality require to be able to implement a local data-store reflecting server-sent data-update messages.

Web.DDP.Deadpan.Callbacks is used frequently in Web.DDP.Deadpan.

Synopsis

Documentation

clientDataSub :: GUID -> Text -> [EJsonValue] -> DeadpanApp GUID Source

Initiate a subscription to a named collection on the server.

Provide an id to refer to the subscription in future.

  sub (client -> server):
    id:     string                        (an arbitrary client-determined
                                              identifier for this subscription)
    name:   string                        (the name of the subscription)
    params: optional array of EJSON items (parameters to the subscription)

subscribe :: Text -> [EJsonValue] -> DeadpanApp GUID Source

Activates a subscription with an auto-generated ID, returning the ID.

clientDataUnsub :: GUID -> DeadpanApp () Source

Unsubscribe from an existing subscription indicated by its ID.

  unsub (client -> server):
    id: string (the id passed to sub)

clientRPCMethod :: Text -> [EJsonValue] -> GUID -> Maybe Text -> DeadpanApp GUID Source

As explained in the Meteor DDP documentation:

     method:     string                        (method name)
     params:     optional array of EJSON items (parameters to the method)
     id:         string                        (an arbitrary client-determined identifier for this method call)
     randomSeed: optional JSON value           (an arbitrary client-determined seed for pseudo-random generators)
 

rpcWait :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue) Source

Like clientRPCMethod, except that it blocks, returning the response from the server.

TODO: Should we use the seed?