subscribe method

Future<Channel?> subscribe([
  1. String channelName = DEFAULT_CHANNEL_NAME
])

Implementation

Future<Channel?> subscribe(
    [String channelName = DEFAULT_CHANNEL_NAME]) async {
  int handle = _channelHandle++;
  return _messagingChannel.invokeMethod(
      "Backendless.Messaging.subscribe", <String, dynamic>{
    "channelName": channelName,
    "channelHandle": handle
  }).then((value) => new Channel(_messagingChannel, channelName, handle),
      onError: (e) {
    String errorMessage = "Couldn't subscribe to the channel: $e";
    if (Platform.isAndroid) {
      errorMessage += "Please check whether you add io.socket dependency.";
    }
    return Future.error(errorMessage);
  });
}