code: function subscribe(api, feed, callback) {
      // A unique-enough ID for this subscription
      let id = ++api._subLinksId;
  
      // Attempt to connect to push API
      connect(api, (err) => {
          if (err) {
              // Notify caller of the connection error
              callback({"msg": "Error: " + err.msg}, null, null, null);
          } else {
              // Proxy for user-supplied callback
              let callbackProxy = (args, kwargs, details) => {
                  // Execute user callback, checking return value for kill signal (anything not false)
                  if (callback(null, args, kwargs, details)) {
                      // Unsubscribe
                      api._connection.session.unsubscribe(api._subLinks[id]);
  
                      // Remove internal reference
                      delete api._subLinks[id];
  
                      // Decrement active subscription counter
                      api._activeSubs--;
  
                      // If no subscriptions remain
                      if (api._activeSubs == 0) {
                          // Close the entire connection (allows program to exit naturally; can be reopened if needed)
                          api._connection.close();
                      }
                  }
              };
  
              // Subscribe to the given feed
              api._connection.session.subscribe(feed, callbackProxy).then(
                  (subscription) => {
                      // Register subscription
                      api._subLinks[id] = subscription;
  
                      // Increment active subscription counter
                      api._activeSubs++;
                  },
                  (err) => {
                      // Call back with error
                      callback({"msg": "Error: " + err}, null, null, null);
                  }
              );
          }
      });
  }
docs: /*
  
  function subscribe(api, feed, callback)
  
  Subscribes to the given WAMP feed. If the connection has not yet been
  established, this function will attempt to do so.
  
  Params
  api         Push wrapper instance being operated on
  feed        A string specifying the desired feed
  callback    A callback function with the following params
  err     An object of the following structure in the
  event of an error, or null if no error has
  occurred: { msg: "error message..." }
  args    Directly-mapped WAMP event payload array
  kwargs  Directly-mapped WAMP event payload object
  details Directly-mapped WAMP event metadata