AS-Devs / signalr_flutter

A flutter plugin for .net SignalR client.
https://pub.dev/packages/signalr_flutter
MIT License
19 stars 27 forks source link

Can't hubMethods be done separately? #22

Closed yasngencc closed 3 years ago

yasngencc commented 3 years ago

await connection.start();

connection.on('ReceiveMessage', (message) { print(message.toString()); }); connection.on('ReceiveMessage2', (message) { print(message.toString()); });

AyonAB commented 3 years ago

That won't be dynamic i'm afraid. I'm trying to create a general way so that everyone can use that. If that still doesn't work for your project, you can always download the plugin, make changes you want to make and use it as a private plugin.

yasngencc commented 3 years ago

merhaba; void subscribeToHubMethod(String methodName) async { try { assert(methodName != null, "methodName can not be null."); await _channel.invokeMethod("listenToHubMethod", methodName); } 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()); } }

burada nasıl bir değişiklik yapmam gerekiyor.. yardım edebilirmisiniz?

AyonAB commented 3 years ago

Get the latest version, this method has been deprecated, see the example.