From 22ce42cc8afef04a63e5a09ad4ce15a772d42e4b Mon Sep 17 00:00:00 2001
From: Ian Gulliver
Returns: A Promise that resolves with no arguments on success, or rejects with no arguments if the client -is denied access to the subject.
+is denied access to read the subject.subscribe() creates a subscription on the server to a particular subject. The subscription is tied to our current instance but is re-created @@ -475,6 +475,40 @@ unsubscribe().
A single call to unsubscribe() undoes all calls to subscribe() for the given subject. + +
Arguments: +
subject: A valid subject (string, number or object with
+ specific keys)message: The message data. Any value that JSON can
+ serialize is valid.Returns: A + +Promise that resolves with no arguments on success, or rejects with no arguments if the client +is denied access to write to the subject.
+ +Sends a message to the given subject. The message +contents are serialized and sent to the server (see +architecture). The server adds metadata (sequence number, +timestamp, sender profile ID), stores the message and sends it on to any current +subscribers to the subject, including possibly back to the local +client. Future subscribers can fetch the historical message from the server's storage (as opposed +to a pin which is ephemeral and tied to the current +instance).
+ +The message may be rejected by server (causing the promise to reject) if the
+subject sets writable_only_by and it does not match our
+current profile.
If we are also subscribed to the given subject and have provided an +onMessage callback, it will fire for this message when it is received +back from the server. You can filter messages by comparing their sender field to the return value +of currentProfile() to avoid processing your own messages.
+