# @aspnet/signalr

> ASP.NET Core SignalR Client

Latest version **1.0.27** (published 2021-04-08) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @aspnet/signalr
pnpm add @aspnet/signalr
yarn add @aspnet/signalr
bun add @aspnet/signalr
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.27 |
| Published | 2021-04-08 |
| First published | 2018-02-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2359 |
| Author | Microsoft |
| Maintainers | npmaspnet, pilchie, jkotalik, brecon, juntaoluo |

## Links

- npm: https://www.npmjs.com/package/@aspnet/signalr
- Repository: https://github.com/aspnet/SignalR
- Homepage: https://github.com/aspnet/SignalR#readme
- Issues: https://github.com/aspnet/SignalR/issues
- npm.io page: https://npm.io/package/@aspnet/signalr

## Recent versions

- 1.0.27 (latest) — 2021-04-08
- 3.0.0-preview6.19307.2 (next) — 2019-06-12
- 1.0.26 — 2021-03-09
- 3.0.0-preview5-19227-01 — 2019-05-06
- 3.0.0-preview4-19216-03 — 2019-04-18
- 1.1.4 — 2019-04-09
- 3.0.0-preview3-19153-02 — 2019-03-06
- 1.1.2 — 2019-02-13
- 3.0.0-preview-19075-0444 — 2019-01-29
- 3.0.0-preview-18579-0056 — 2018-12-04
- 1.1.0 — 2018-12-04
- 1.1.0-preview3-35497 — 2018-10-17
- 1.0.4 — 2018-10-01
- 1.1.0-preview2-35157 — 2018-09-12
- 1.1.0-preview1-35029 — 2018-08-22
- … 8 more at https://npm.io/package/@aspnet/signalr/versions

## 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](https://dotnet.microsoft.com/platform/support/policy/dotnet-core) which is ending soon. Please transition to using [@microsoft/signalr](https://www.npmjs.com/package/@microsoft/signalr) as described below.

> Note: The JavaScript and TypeScript clients for SignalR for ASP.NET Core have been moved to [@microsoft/signalr](https://www.npmjs.com/package/@microsoft/signalr). If you are already using `@aspnet/signalr` and are unsure when to move to `@microsoft/signalr`, check the [Feature Distribution](https://docs.microsoft.com/en-us/aspnet/core/signalr/client-features) 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

```bash
npm install @aspnet/signalr
```

## Usage

See the [SignalR Documentation](https://docs.microsoft.com/en-us/aspnet/core/signalr) 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)

```JavaScript
let connection = new signalR.HubConnectionBuilder()
    .withUrl("/chat")
    .build();

connection.on("send", data => {
    console.log(data);
});

connection.start()
    .then(() => connection.invoke("send", "Hello"));
```

### Example (NodeJS)

```JavaScript
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"));
```

---
_Source: https://npm.io/package/@aspnet/signalr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
