🌜
🌞
@aspnet/signalr

@aspnet/signalr

v1.0.27

ASP.NET Core SignalR Client

npm install @aspnet/signalr

README

JavaScript and TypeScript clients for SignalR for ASP.NET Core

:warning: This package will no longer be supported starting August 21, 2021. This package follows the .NET Core 2.1 support lifecycle which is ending soon. Please transition to using @microsoft/signalr as described below.

Note: The JavaScript and TypeScript clients for SignalR for ASP.NET Core have been moved to @microsoft/signalr. If you are already using @aspnet/signalr and are unsure when to move to @microsoft/signalr, check the Feature Distribution chart in the ASP.NET Core SignalR documentation. Newer client releases are compatible with older version of ASP.NET Core SignalR which means it is safe to upgrade the client before upgrading the server.

Installation

npm install @aspnet/signalr

Usage

See the SignalR Documentation at docs.microsoft.com for documentation on the latest release.

Browser

To use the client in a browser, copy *.js files from the dist/browser folder to your script folder include on your page using the <script> tag.

Node.js

The following polyfills are required to use the client in Node.js applications:

  • XmlHttpRequest - always
  • WebSockets - to use the WebSockets transport
  • EventSource - to use the ServerSentEvents transport
  • btoa/atob - to use binary protocols (e.g. MessagePack) over text transports (ServerSentEvents)

Example (Browser)

let connection = new signalR.HubConnectionBuilder()
    .withUrl("/chat")
    .build();

connection.on("send", data => {
    console.log(data);
});

connection.start()
    .then(() => connection.invoke("send", "Hello"));

Example (NodeJS)

const signalR = require("@aspnet/signalr");

let connection = new signalR.HubConnectionBuilder()
    .withUrl("/chat")
    .build();

connection.on("send", data => {
    console.log(data);
});

connection.start()
    .then(() => connection.invoke("send", "Hello"));

General

License
Apache-2.0
Typescript Types
None found
Tree-shakeable
Yes

Popularity

GitHub Stargazers
2,401
Community Interest
3,166
Number of Forks
460

Maintenance

Commits
10/219/2201
Last Commit
Nov 28, 2018
Open Issues
0
Closed Issues
1,659
Open Pull Requests
0
Closed Pull Requests
201

Versions

Versions Released
10/219/2201
Latest Version Released
Apr 8, 2021
Current Tags
latest1.0.27
next3.0.0-preview6.19307.2

Dependencies

Dependencies (3)
Dev Dependencies (1)

Contributors

BrennanConroy
BrennanConroy
Commits: 310
davidfowl
davidfowl
Commits: 276
anurse
anurse
Commits: 197
mikaelm12
mikaelm12
Commits: 188
JamesNK
JamesNK
Commits: 110
moozzyk
moozzyk
Commits: 62
aspnetci
aspnetci
Commits: 56
pranavkm
pranavkm
Commits: 49
ryanbrandenburg
ryanbrandenburg
Commits: 16
pakrym
pakrym
Commits: 16
natemcmaster
natemcmaster
Commits: 12
HaoK
HaoK
Commits: 11
kichalla
kichalla
Commits: 7
mikeharder
mikeharder
Commits: 7
DylanDmitri
DylanDmitri
Commits: 7