Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@ssv/signalr-client
Advanced tools
Changelog
5.0.0 (2023-09-08)
HubConnection.connectionId
DesiredConnectionStatus
connect()
remain in invalid state causing connecting/disconnecting@microsoft/signalr: ^7.0.0
as peerDependency
esm
and cjs
Readme
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
Get library via npm
npm install @ssv/signalr-client @microsoft/signalr
Check out the API Documentation Page.
There are three simple steps:
HubConnectionFactory
in your DI eco systemHubConnectionFactory
and using create
)HubConnectionFactory
and call method get
by passing the key
for a specific hub connection, this will return HubConnection
HubConnection
to use enhanced signalr featuresHubConnectionFactory
as a ProviderYou're all set! Now it's fully integrated with your Angular application.
Continue from the vanilla usage - step 2 onwards
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 { 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 readonly _destroy$ = new Subject<void>();
constructor(hubFactory: HubConnectionFactory) {
this.hubConnection = hubFactory.get<HeroHub>("hero");
}
ngOnInit(): void {
this.hubConnection.connect().pipe(
takeUntil(this._destroy$),
).subscribe(() => console.log(`connected!!`));
this.hubConnection.on<Hero>("HeroChanged", "singed").pipe(
takeUntil(this._destroy$),
).subscribe(x => console.log(`hero :: singed :: update received`, x));
}
ngOnDestroy() {
this._destroy$.next();
this._destroy$.complete();
}
}
export interface HeroHub {
HeroChanged: string;
}
export interface Hero {
id: string;
name: string;
health: number;
}
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:
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:
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);
});
Check out the development guide.
FAQs
SignalR client library built on top of @microsoft/signalr. This gives you more features and easier to use.
The npm package @ssv/signalr-client receives a total of 153 weekly downloads. As such, @ssv/signalr-client popularity was classified as not popular.
We found that @ssv/signalr-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.