conficient/BlazorChatSample

Modify methods used in client to be async

conficient opened this issue · 3 comments

At present the Start(), Send() and Stop() methods are all synchronous, but it's likely the underlying js methods are async, returning promises.

Need to rewrite ChatClient to be async and amend chatClient.js to match.

SignalR documentation says that connection.invoke does return a promise. I tried to change the ChatClient.Send function to return this promise and handle it in ChatClient.cs but it didn't work.

Amended the code to update for 0.5.0 and this only supports async methods.

An important point to note is that even if a JS method does not return a value, it should be called with invokeAsync<object> otherwise the call never completes. I did try invokeAsync<bool> originally and this didn't work.

Upgraded to 0.5.0 which requires use of async calls