如何从 android 信号器调用中获取数据
how to get data from android signalr invoke
如何从调用方法中检索数组? invoke 方法有效,但我找不到如何在 Java 客户端中从中获取数组。
HubConnection hubConnection;
hubConnection = HubConnectionBuilder.create(Constants.BASE_LOCAL_HUB_URL).withAccessTokenProvider(Single.defer(() -> {
// Your logic here.
return Single.just(token);
})).build();
hubConnection.invoke(UserViewModel[].class, "GetUsers");
调用 returns a Single<T>
,其中 T 是您指定的类型 (UserViewModel[]
)。
所以您需要通过订阅Single来使用return值。 https://www.tutorialspoint.com/rxjava/rxjava_single_observable.htm
测试它是否正常工作的最快方法是:
UserViewModel[] arr = hubConnection.invoke(UserViewModel[].class, "GetUsers").blockingGet();
如何从调用方法中检索数组? invoke 方法有效,但我找不到如何在 Java 客户端中从中获取数组。
HubConnection hubConnection;
hubConnection = HubConnectionBuilder.create(Constants.BASE_LOCAL_HUB_URL).withAccessTokenProvider(Single.defer(() -> {
// Your logic here.
return Single.just(token);
})).build();
hubConnection.invoke(UserViewModel[].class, "GetUsers");
调用 returns a Single<T>
,其中 T 是您指定的类型 (UserViewModel[]
)。
所以您需要通过订阅Single来使用return值。 https://www.tutorialspoint.com/rxjava/rxjava_single_observable.htm
测试它是否正常工作的最快方法是:
UserViewModel[] arr = hubConnection.invoke(UserViewModel[].class, "GetUsers").blockingGet();