Skip to content

A lightweight abstraction layer for SignalR in .NET Core, designed to solve the problem of 'single hub overload.' This library streamlines request handling, action execution, and event management, offering a more modular and scalable approach to building SignalR-based applications.

Notifications You must be signed in to change notification settings

Karizma-Studio/KarizmaConnection

Repository files navigation

KarizmaConnection

KarizmaConnection is a lightweight abstraction layer built on top of SignalR for .NET Core, designed to eliminate "single hub overload" and simplify the management of requests, actions, and events within a SignalR-based system. It provides a modular and scalable structure, making it easier to handle multiple actions and events across different handlers.

Features

  • Modular handling of SignalR requests and events.
  • Attribute-based routing for actions and events.
  • Simplified client-server interaction using a single hub connection.

Installation

To install the package:

dotnet add package KarizmaConnection

Getting Started

Setup

  1. Define your handlers using attributes:

    [RequestHandler("user")]
    public class UserHandler : BaseRequestHandler
    {
        [Action("login")]
        public Task Login(LoginDto loginData) {
             /* logic */ 
         }
    }
  2. Add KarizmaConnection to the service collection:

    services.AddKarizmaConnection();
  3. Initialize the KarizmaConnection hub in WebApplication:

    app.MapKarizmaConnectionHub("/mainHub");

Attributes

  • [RequestHandler]: Marks a class as a request handler.
  • [Action]: Marks a method as an executable action.
  • [EventHandler]: Marks a method for handling hub events (e.g., onConnected, onDisconnected).

Contributing

Feel free to contribute by submitting issues or pull requests!

About

A lightweight abstraction layer for SignalR in .NET Core, designed to solve the problem of 'single hub overload.' This library streamlines request handling, action execution, and event management, offering a more modular and scalable approach to building SignalR-based applications.

Resources

Stars

Watchers

Forks

Packages

No packages published