All Projects → sketch7 → signalr-client

sketch7 / signalr-client

Licence: MIT License
SignalR client library built on top of @aspnet/signalr. This gives you more features and easier to use.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to signalr-client

ChatService
ChatService (SignalR).
Stars: ✭ 26 (-45.83%)
Mutual labels:  real-time, realtime, signalr
IPRadar2
Real-time detection and defense against malicious network activity and policy violations (exploits, port-scanners, advertising, telemetry, state surveillance, etc.)
Stars: ✭ 20 (-58.33%)
Mutual labels:  real-time, realtime
intrinio-realtime-python-sdk
Intrinio Python SDK for Real-Time Stock Prices
Stars: ✭ 79 (+64.58%)
Mutual labels:  real-time, realtime
TweetMigration
A WebGL heatmap of global Twitter activity
Stars: ✭ 42 (-12.5%)
Mutual labels:  real-time, realtime
soketi
Just another simple, fast, and resilient open-source WebSockets server. 📣
Stars: ✭ 2,202 (+4487.5%)
Mutual labels:  real-time, realtime
app
Source code of intencje.pl website and mobile/desktop apps based on Angular, Firebase, and Capacitor.
Stars: ✭ 12 (-75%)
Mutual labels:  rxjs, realtime
aws-mobile-appsync-events-starter-ios
GraphQL starter application with Realtime and Offline functionality using AWS AppSync
Stars: ✭ 99 (+106.25%)
Mutual labels:  real-time, realtime
signalr
SignalR server and client in go
Stars: ✭ 69 (+43.75%)
Mutual labels:  signalr, signalr-client
accelerator-core-ios
Syntax sugar of OpenTok iOS SDK with Audio/Video communication including screen sharing
Stars: ✭ 30 (-37.5%)
Mutual labels:  real-time, realtime
realtime-object-detection
Detects objects in images/streaming video
Stars: ✭ 16 (-66.67%)
Mutual labels:  real-time, realtime
transit
Massively real-time city transit streaming application
Stars: ✭ 20 (-58.33%)
Mutual labels:  real-time, realtime
Embedded UKF Library
A compact Unscented Kalman Filter (UKF) library for Teensy4/Arduino system (or any real time embedded system in general)
Stars: ✭ 31 (-35.42%)
Mutual labels:  real-time, realtime
microbium-app
Draw new worlds
Stars: ✭ 89 (+85.42%)
Mutual labels:  real-time, realtime
ripple
Simple shared surface streaming application
Stars: ✭ 17 (-64.58%)
Mutual labels:  real-time, realtime
FastPose
pytorch realtime multi person keypoint estimation
Stars: ✭ 36 (-25%)
Mutual labels:  real-time, realtime
dotNetify-react-native-demo
DotNetify + React Native + .NET Core demo
Stars: ✭ 43 (-10.42%)
Mutual labels:  realtime, signalr
TypedSignalR.Client
C# Source Generator to Create Strongly Typed SignalR Client.
Stars: ✭ 16 (-66.67%)
Mutual labels:  signalr, signalr-client
Sanity
The Sanity Studio – Collaborate in real-time on structured content
Stars: ✭ 3,007 (+6164.58%)
Mutual labels:  real-time, realtime
UnityR
Unity3D, SignalR real-time multiplayer game
Stars: ✭ 49 (+2.08%)
Mutual labels:  realtime, signalr
traffic
Massively real-time traffic streaming application
Stars: ✭ 25 (-47.92%)
Mutual labels:  real-time, realtime

@ssv/signalr-client

CircleCI npm version

SignalR client library built on top of @aspnet/signalr. This gives you more features and easier to use.

Quick links

Change logs | Project Repository | API Documentation

Features

  • Fully TypeScript and ReactiveX
  • Multiple hub connections state management
  • Connection state notifications
  • Update connection details easily without losing current connection state
  • Subscriptions are handled through RxJS streams
  • Reconnection strategies
    • Random strategy
    • BackOff strategy
    • Random BackOff strategy
    • Custom strategy
  • Auto re-subscriptions after getting disconnected and re-connected
  • Contains minimal dependencies (SignalR and RxJS only)
  • No constraints with any framework
  • Designed to be straight forward integrated with any framework such as Angular, Aurelia, React, Vue, etc...

Samples

Installation

Get library via npm

npm install @ssv/signalr-client

API Documentation

Check out the API Documentation Page.

Usage

There are three simple steps:

  1. Register HubConnectionFactory in your DI eco system
  2. In application bootstrap:
    • Register one or more hub connections (by injecting HubConnectionFactory and using create)
  3. Somewhere in your components/services you need:
    • Inject HubConnectionFactory and call method get by passing the key for a specific hub connection, this will return HubConnection
    • Use HubConnection to use enhanced signalr features

Angular Adapter

  1. Register HubConnectionFactory as a Provider

You're all set! Now it's fully integrated with your Angular application.

Continue from the vanilla usage - step 2 onwards

Angular Basic Example

import { HubConnectionFactory } from "@ssv/signalr-client";

@NgModule({
	providers: [
		HubConnectionFactory,
		...
	]
})
export class AppModule {

    constructor(factory: HubConnectionFactory) {
		factory.create(
			{ key: "hero", endpointUri: "/hero" },
			{ key: "user", endpointUri: "/userNotifications" }
		);
	}
}

sample usage in components:

import { ISubscription } from "rxjs/Subscription";
import { Component, OnInit, OnDestroy } from "@angular/core";
import { HubConnectionFactory, HubConnection } from "@ssv/signalr-client";

@Component({
	selector: "hero-detail",
	templateUrl: "./hero-detail.component.html"
})
export class HeroDetailComponent implements OnInit, OnDestroy {

	private hubConnection: HubConnection<HeroHub>;
	private hero$$: ISubscription;
  private hubConnection$$: ISubscription;

	constructor(hubFactory: HubConnectionFactory) {
		this.hubConnection = hubFactory.get<HeroHub>("hero");
	}

	ngOnInit(): void {
  	this.hubConnection$$ = this.hubConnection.connect()
			.subscribe(() => console.log(`connected!!`));
      
		this.hero$$ = this.hubConnection.stream<Hero>("GetUpdates", "singed")
		.subscribe(x => console.log(`hero stream :: singed :: update received`, x));
	}

	ngOnDestroy(): void {
		if (this.hero$$) {
			this.hero$$.unsubscribe();
		}
	}
}

export interface HeroHub {
	GetUpdates: string;
}

export interface Hero {
	id: string;
	name: string;
	health: number;
}

Raw Basic Example

Create an instance of HubConnectionFactory ideally will be registered into your DI (if you're using any library) or you can create instance manually.

Step 1:

  • Register Hubs in the HubConnectionFactory
import { HubConnectionFactory, HubConnection } from "@ssv/signalr-client";

const hubFactory = new HubConnectionFactory();
hubFactory.create(
	{ key: "hero", endpointUri: "/hero" },
	{ key: "user", endpointUri: "http://localhost:62551/real-time/user" }
);

Step2:

  • Get Hub by Key
  • Connect
  • subscribe for on
const hubConnection = hubFactory.get<HeroHub>("hero");
const hubConnection$$ = hubConnection.connect().subscribe(() => {
	console.log(`connected!`);
});

const data$$ = hubConnection.on<string>("Send").subscribe(val => {
	console.log(`send :: data received >>>`, val);
});

Contributions

Check out the development guide.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].