sub method

Future<Map<String, dynamic>> sub({
  1. required String topic,
})

EXPERIMENTAL

Subscribe to messages on a given topic. /api/v0/pubsub/sub

Arguments:

  • topic String: Topic to publish to (multibase encoded when sent over HTTP RPC).

Response:

{
  "data": "<string>",
  "from": "<string>",
  "seqno": "<string>",
  "topicIDs": [
    "<string>"
  ],
  "StatusCode": "<statusCode>",
  "StatusMessage": "<statusMessage>"
}

See more: https://docs.ipfs.io/reference/http/api/#api-v0-pubsub-sub

Implementation

Future<Map<String, dynamic>> sub({required String topic}) async {
  Response? res = await _post(
    Ipfs.dio,
    url: "${Ipfs.url}/pubsub/sub",
    queryParameters: {
      "arg": topic,
    },
  );

  return _interceptDioResponse(res, expectsResponseBody: true);
}