Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- pingCallback :: Callback
- clientDataSub :: GUID -> Text -> [EJsonValue] -> DeadpanApp GUID
- subscribe :: Text -> [EJsonValue] -> DeadpanApp GUID
- subscribeWaitId :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue (GUID, EJsonValue))
- subscribeWait :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue)
- clientDataUnsub :: GUID -> DeadpanApp ()
- unsubscribe :: GUID -> DeadpanApp ()
- clientRPCMethod :: Text -> [EJsonValue] -> GUID -> Maybe Text -> DeadpanApp GUID
- rpc :: Text -> [EJsonValue] -> DeadpanApp GUID
- rpcWait :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue)
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.
subscribeWaitId :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue (GUID, EJsonValue)) Source
subscribeWait :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue) Source
clientDataUnsub :: GUID -> DeadpanApp () Source
Unsubscribe from an existing subscription indicated by its ID.
unsub (client -> server):
id: string (the id passed to sub
)
unsubscribe :: GUID -> DeadpanApp () Source
Synonym for clientDataUnsub
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)
rpc :: Text -> [EJsonValue] -> DeadpanApp GUID Source
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?