Socket
Book a DemoInstallSign in
Socket

@b2broker/signalr

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@b2broker/signalr

ASP.NET Core SignalR Client

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

JavaScript and TypeScript clients for SignalR for ASP.NET Core and Azure SignalR Service (forked from @microsoft/signalr)

Installation

npm install @b2broker/signalr
# or
yarn add @b2broker/signalr

To try previews of the next version, use the next tag on NPM:

npm install @b2broker/signalr@next
# or
yarn add @b2broker/signalr@next

Usage

See the SignalR Documentation at docs.microsoft.com for documentation on the latest release. API Reference Documentation is also available on docs.microsoft.com.

For documentation on using this client with Azure SignalR Service and Azure Functions, see the SignalR Service serverless developer guide.

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.

WebWorker

To use the client in a webworker, copy *.js files from the dist/webworker folder to your script folder include on your webworker using the importScripts function. Note that webworker SignalR hub connection supports only absolute path to a SignalR hub.

Node.js

To use the client in a NodeJS application, install the package to your node_modules folder and use require('@b2broker/signalr') to load the module. The object returned by require('@b2broker/signalr') has the same members as the global signalR object (when used in a browser).

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 (WebWorker)

importScripts('signalr.js');

let connection = new signalR.HubConnectionBuilder()
    .withUrl("https://example.com/signalr/chat")
    .build();

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

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

Example (NodeJS)

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

const headers = { "X-API-KEY": "SECRET", "X-SIGNATURE": "SIGNATURE" };

let connection = new signalR.HubConnectionBuilder()
    .withUrl("/chat", { headers })
    .build();

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

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

Keywords

signalr

FAQs

Package last updated on 21 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.