'Does ASP.NET Core SignalR or SignalR Java client have an issue with sending or receiving null values?

I am creating a multiplayer card game. I use ASP.NET Core SignalR for full duplex communication with an Android client written in Java. On Android I use the SignalR Java client library.

For some communication I find it natural to just use signalR for synchronous request-response type of thing. SignalR allows for such as exampled below.

public async Task<string> GetString(){ return "foo"; }

This works as intended. I can invoke the server method from Android and get a response either blocking or via a callback.

Now to the problem. I have scenarios where I find it suitable to return a null object from the SignalR method.

public async Task<GameState?> GetGameState(string gameName){
    if (gameIsCanceled) return null;
    else return new ProperGameState();
}

In this kind of scenario it seems like the case where I return an actual game state object works fine. But the cases in which I return null nothing is returned.

Single<String> stringPromise = hubConnection.invoke(String.class, "GetRunningGame");
String runningGameName =  stringPromise.blockingGet();

Above is like the invokation looks in Android. It does not get pass the blockingGet()

Anyone come across this or got any idea what I might be doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source