Open afca-paul opened 5 years ago
I am getting the same error above. With my own variant of the back end parts i.e. my own Azure function. And the UWP client (adapted) from here. Pity - I'd really like to use this tech stack i.e. Azure SignalR + Azure Functions + Xamarin client. This is a show stopper.
I did find a workaround by doing the serialization upfront and use a json-string as message:
string json = JsonConvert.SerializeObject(statusUpdate, Formatting.Indented);
await signalRMessages.AddAsync(
new SignalRMessage
{
Target = "updateStatus",
Arguments = new[] { json }
});
I hope this helps.
Here is my approach
[FunctionName("SendMessage")]
public static async Task SendMessage(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
[SignalR(HubName = "chat")] IAsyncCollector<SignalRMessage> signalRMessages)
{
var content = await new StreamReader(req.Body).ReadToEndAsync();
await signalRMessages.AddAsync(
new SignalRMessage
{
Target = "newMessage",
Arguments = new[] { content }
});
}
Is this an actual issue or the workaround that @afca-paul and @jhofer provided is what we are supposed to do (permanent solution)?
By the way @jhofer your solution worked perfectly for me, thanks!
If I execute the csharp code (/src/chat/csharp) Function "messages" on Azure Function Runtime Version: 2.0.12742.0 I get the following exception:
System.Private.CoreLib: Exception while executing function: messages. Newtonsoft.Json: Error getting value from 'ReadTimeout' on 'Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream'. System.Private.CoreLib: Timeouts are not supported on this stream.