setMeta method

Future setMeta(
  1. String topicName,
  2. SetParams params
)

Update topic's metadata: description, subscriptions

Implementation

Future setMeta(String topicName, SetParams params) {
  var packet = _packetGenerator.generate(packet_types.Set, topicName);
  var data = packet.data as SetPacketData;

  var what = [];
  if (params != null) {
    if (params.desc != null) {
      what.add('desc');
      data.desc = params.desc;
    }
    if (params.sub != null) {
      what.add('sub');
      data.sub = params.sub;
    }
    if (params.tags != null) {
      what.add('tags');
      data.tags = params.tags;
    }
    if (params.cred != null) {
      what.add('cred');
      data.cred = params.cred;
    }

    if (what.isEmpty) {
      throw Exception('Invalid {set} parameters');
    }
  }

  return _send(packet);
}