Skip to content

Microsoft.AspNet.SignalR.JS

reference
1 min readUpdated

Kind: Service

Source: Pams/Web/Pams.Web/Pams.Web.csproj (line 1)

Part of: Pams

NuGet package dependency

Microsoft.AspNet.SignalR.JS provides the JavaScript client assets for ASP.NET SignalR in the Pams web application. It enables browser code to connect to SignalR hubs exposed by the server, receive server events, and invoke hub methods.

Diagram

mermaid
sequenceDiagram
    participant Browser
    participant SignalRClient as Microsoft.AspNet.SignalR.JS
    participant SignalRServer as ASP.NET SignalR Hub

    Browser->>SignalRClient: Load /signalr/hubs
    SignalRClient->>SignalRServer: Start connection
    SignalRServer-->>SignalRClient: Connection established
    SignalRClient->>SignalRServer: Invoke hub method
    SignalRServer-->>SignalRClient: Send client event
    SignalRClient-->>Browser: Run registered callback

Usage

javascript
// Load jQuery, jquery.signalR, and the generated /signalr/hubs script first.

const notifications = $.connection.notificationsHub;

notifications.client.receiveNotification = function (message) {
    console.log("Notification received:", message);
};

$.connection.hub.start()
    .done(function () {
        notifications.server.subscribe();
    })
    .fail(function (error) {
        console.error("SignalR connection failed:", error);
    });

AI Coding Instructions

  • Keep the Microsoft.AspNet.SignalR.JS package reference aligned with the server-side ASP.NET SignalR package version.
  • Load the generated /signalr/hubs script after jQuery and the SignalR client script.
  • Register hub.client callbacks before calling $.connection.hub.start().
  • Call server hub methods through hub.server only after the SignalR connection has started.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Injected or called by (1)

  • Pams.WebPams/Web/Pams.Web/Pams.Web.csproj:1

Was this page helpful?

Download as PDF