connect method
Connect to the SignalR Server with given baseUrl & hubName.
queryString is a optional field to send query to server.
Implementation
Future<bool?> connect() async {
try {
final result = await _channel
.invokeMethod<bool>("connectToServer", <String, dynamic>{
'baseUrl': baseUrl,
'hubName': hubName,
'queryString': queryString ?? "",
'headers': headers ?? {},
'hubMethods': hubMethods ?? [],
'transport': transport.index
});
_signalRCallbackHandler();
return result;
} on PlatformException catch (ex) {
print("Platform Error: ${ex.message}");
return Future.error(ex.message!);
} on Exception catch (ex) {
print("Error: ${ex.toString()}");
return Future.error(ex.toString());
}
}