Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electrum-signalr

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electrum-signalr

Electrum SignalR implements a Hub Loader.

  • 2.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

electrum-signalr

NPM version

This wrapper hides the depencies to SignalR and jQuery, so that it gets possible to use ES6 import to get a properly configured SignalR instance, and then use the HubLoader class to establish a bidirectional connection with the SignalR server.

import SignalR from 'electrum-signalr';

const hubUrl = '...';
const ownUrl = '...';
let loader = new SignalR.HubLoader ('fooHub');
loader.Load (hubUrl, ownUrl, () => console.log ('Ready'));

The HubLoader class

Methods

The HubLoader class defines following public methods:

  • constructor (hubName) → specify the name of the SignalR hub.
  • load (hubUrl, ownUrl, ready) → load the proxy for the given hub; the URL of the hub and of the client endpoint need to be provided; ready will be called with the instance of the HubLoader when the proxy is ready for use. Typically, ready(loader) should call loader.start().
  • start () → start the communication between the proxy and the distant hub; this will establish the SignalR communication channel.
  • setupProxy (factory) → configure the proxy by injecting it the handler's methods; the handler is returned by the factory. Methods which start with an underscore (_) will not be injected.

Note: setupProxy (factory) takes a proxy => handler callback as argument.

Getters

The HubLoader class defines following public getters:

  • hub → the client-side hub instance.
  • hubName → the name of the hub, as provided to the constructor.
  • hubProxy → the proxy to the server hub.
  • connection → the SignalR connection.

Static getters

The HubLoader class exposes jQuery as a static getter:

const jQuery = SignalR.HubLoader.jQuery ();

Internal notifications

The HubLoader calls life cycle methods when things happen:

  • onConnected () → the client and the server hubs are now connected.
  • onConnectFailed () → the connection failed.
  • onError (error) → there was an error while exchanging messages between the hubs.

You can overload these methods if you need to handle the notifications. Otherwise, they will just display messages on the console.

FAQs

Package last updated on 19 Apr 2016

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc