Skip to main content

Posts

Featured

SignalR with JavaScript in ASP.NET Core MVC

This blog is going to explain what is SignalR and how to implement it in ASP.NET Core. SignalR is a real time application framework for ASP.NET Core. Using SignalR you can provide updated information without refreshing the page, for example poll results, game score, chat etc. Let's see how to achieve it in ASP.NET Core MVC. Step 1: First step I added the SignalR client library. To add a SignalR client library, Right click on the project in Solution Explorer and Add -> Client-Side Library. Select the provider as unpkg as shown in the image below. Enter the latest version of SignalR into the library. And selected signalr.js and signalr.min.js files. Finally clicked the install button to install the client library. Step 2: At this step I have created a VoteHub.cs class inside the Hubs folder(create a new folder called Hubs). This class inherits from the Hub class which is a base class of SignalR hub. The SendMessage method will be called by the connected client.

Latest Posts

View-Based Authorization in ASP.NET Core

Policy-Based Authorization in ASP.NET Core

Startup Class in ASP.NET Core

In-Memory Cache in ASP.NET Core

ASP.NET Core Web API Documentation with Swagger

Role-Based Authorization in ASP.NET Core MVC

Dependency Injection in ASP.NET Core MVC

Global Authorization Filter in ASP.NET Core

Simple Cookie Authentication in ASP.NET Core