Asp Net Core Signalr
I am learning SignalR but have hit a road block.
Copyrightstatement Datecreated Distributor Equipmentused Firstpublished Format MovingImage Framerate Fullversionurl Identifier MicrosoftFable2tfable2e36mp4 Isclip False Languageused Maturecontent False Monochromatic False Moreinfo Originalformat Othercopyrightholders False Otherholderdetails Otherpurpose Otherversions Peopledepicted Producer Productioncompany Purchaseinfo Rating Resource MovingImage Reviews Setting Syndication Transcript Uniqueidentifier Uploadapplication Videogenre Videogenreother Videotype. Download fable 2 pc ripheral technology.
- Sep 12, 2017. This article shows how to setup a first SignalR Hub in ASP.NET Core 2.0 and use it with an Angular client. SignalR will be released with dotnet 2.1. Thanks to Dennis Alberti for his help in setting up the code example. Code: Other posts in this.
- This tutorial teaches the basics of building a real-time app using SignalR. You learn how to: Create a web project. Add the SignalR client library. Create a SignalR hub. Configure the project to use SignalR. Add code that sends messages from any client to all connected clients. Visual Studio 2019.
I have an Azure function which is successfully posting to Azure SignalR Hosted Service (configured in Serverless Mode)
I've been following this quickstart:
What I would like to achieve is to essentially receive messages from Servers into my client application. To prototype this I have created a Console Application.
I have added the following Nuget Packages
Microsoft.AspNetCore.SignalR.Client -Version 1.1.0 Microsoft.Azure.WebJobs.Extensions.SignalRService
The ASP.NET Core SignalR JavaScript client library enables developers to call server-side hub code. Typically, browsers load connections from the same domain as the requested page. However, there are occasions when a connection to another domain is required. To prevent a malicious site from reading.
All of the infrastructure seems to be working fine - I am basing that assumption on the face that I can run the demo website at the following address, point it at my local instance (or my instance hosted in Azure)https://azure-samples.github.io/signalr-service-quickstart-serverless-chat/demo/chat-v2/
Messages posted by my AzureFunction publish directly into the Chat Window.
Asp.net Core Signalr System
How can I get these messages to print to a console?
I strongly suspect my problem is related the
connection.On<..>
statements. They never fire. The Connection.StartAsync() seems to work fine and establishes a connection to Azure SignalR instance.
Am I missing some fundamental point? I am just thrashing about at this point.
In Short - can someone please give me a pointer to RECEIVING and WRITING messages to my console window - much in the same way as messages are printed to the web browser in the web chat demo (see second link above).
The messages are simple broadcast messages that I want to go to all connected clients.
Nearly all examples are in Javascript.
Thanks in Advance.
2 Answers
Once I discovered how to add logging to SignalR I could see that it could not resolve the type which was being sent.
It worked once I changed my connection.On to the correct type such as
My thinking was mislead by looking at the article Azure Functions development and configuration with Azure SignalR Service
Where they 'seemingly' (atleast in my mind) add a message of type 'SignalRMessage' to SignalR. When in fact they were adding a message type of 'CorrectType'
I managed to get around it by passing in 'object' when calling 'connection.On' instead of having to create the CorrectType class and let .net figure out of how the object is going to look like.
It was indeed the resolving of the type that prevented the .On from firing on a windows client.