Class: ddpSubscription

ddpSubscription

DDP subscription class.

new ddpSubscription (pubname, args, ddplink)

Name Type Description
pubname String

Publication name.

args Array

Subscription arguments.

ddplink simpleDDP

simpleDDP instance.

Classes

ddpSubscription

Methods

isOn ()Promise

Returns true if subscription is active otherwise false.

Returns:
Type Description
Promise

isReady ()boolean

Returns true if subsciprtion is ready otherwise false.

Returns:
Type Description
boolean

isStopped ()boolean

Returns true if subscription is stopped otherwise false.

Returns:
Type Description
boolean

nosub ()Promise

Returns a promise which resolves when corresponding nosub message arrives. Rejects when nosub comes with error.

Returns:
Type Description
Promise

onNosub (f)ddpEventListener

Runs everytime when nosub message corresponding to the subscription comes from the server.

Name Type Description
f function

Function, event handler.

Returns:
Type Description
ddpEventListener

onReady (f)ddpEventListener

Runs everytime when ready message corresponding to the subscription comes from the server.

Name Type Description
f function

Function, event handler.

Returns:
Type Description
ddpEventListener

ready ()Promise

Returns a promise which resolves when subscription is ready or rejects when nosub message arrives.

Returns:
Type Description
Promise

remove ()

Completly removes subscription.

restart (args)Promise

Restart the subscription. You can also change subscription arguments. Returns a promise which resolves when subscription is ready.

Name Type Description
args Array optional

Subscription arguments.

Returns:
Type Description
Promise

start (args)Promise

Start the subscription. Runs on class creation. Returns a promise which resolves when subscription is ready.

Name Type Description
args Array

Subscription arguments.

Returns:
Type Description
Promise

stop ()Promise

Stops subscription and return a promise which resolves when subscription is stopped.

Returns:
Type Description
Promise