encode method

dynamic encode(
  1. dynamic obj,
  2. dynamic callback
)

Implementation

encode(obj, callback) {
  if (binaryEventValue == obj['type'] || binaryAckValue == obj['type']) {
    encodeAsBinary(obj, callback);
  } else {
    var encoding = encodeAsString(obj);
    callback([encoding]);
  }
}