I have this class. Iād like, the client of this class gets the instance of the field chatHub as soon as chatHub assigned in the callback connection.connected(() -> chatHub = connection.createHubProxy("ChatHub")); chatHub might be null. We have to push chatHub through subscriber as soon as it has been initialized; any ideas?
public class SignalRManager {
private HubProxy chatHub;
public SignalRManager() {
Platform.loadPlatformComponent(new AndroidPlatformComponent());
HubConnection connection = new HubConnection("https://test.chatlasapp.com/signalr/hubs");
connection.stateChanged((connectionState, connectionState2) -> Log.i("SignalR", connectionState.name() + "->" + connectionState2.name()));
connection.closed(() -> {
Log.i("SignalR", "Closed");
chatHub = null;
connection.start();
});
//As soon as HubConnection connected this callback invokes.
connection.connected(() -> chatHub = connection.createHubProxy("ChatHub"));
connection.start();
}
Observable<HubProxy> getHubProxy(){
}
}
I'm wondering how to implement getHubProxy method properly? Thanks in advance!