rgrueneis-signalr-gen v2.4.2
General
This package generates an Angular or a WPF/C# service with the specifcation of a C# hub.
Prerequesites
The backend needs to add the middleware GrueneisR.SignalRAnalyzer
.
Installation
Install with npm:
npm install -D rgrueneis-signalr-gen
or yarn:
yarn add -D rgrueneis-signalr-gen
Basic usage in Angular
Add the following line to the scripts section of your package.json:
export class HomeComponent implements OnInit, MyHubServerToClient {
private hubService = inject(MyHubService);
ngOnInit(): void {
this.hubService.attach(this);
this.hubService.startConnection(`${environment.apiRoot}/hubs/myhub`);
}
ngOnDestroy(): void {
this.hubService.detach(this);
}
}
Configuration
The tool requires a configuration file name signalrgen.json. If it does not exist, a default version of this file is generated in the root folder after the first call.
{
"analyzerUri": "http://localhost:5000/hubanalyzer",
"relativeTargetPath": "signalrbridge"
"type": "angular",
"hubName": "DemoHub",
"useHubSuffixInContract": true,
"includeContractDtosNamespace": true
}
Properties:
Property | Description | Default |
---|---|---|
analyzerUri | URL to the backend where the data for the hubs is provided | "http://localhost:5000/hubanalyzer" |
relativeTargetPath | folder where the typescript classes are generated | |
type | angular or wpf | angular |
hubName | If set, only the classes for this hub are generated | |
useHubSuffixInContract | WPF only. If set, the namespace of the contract is expected to include "Hub", e.g. DemoHubContracts | false |
includeContractDtosNamespace | WPF only. If set, adds a using like using DemoContracts.Dtos;. Use it, if your Hub interface include a DTO | false |
Script
Add the following line to the scripts section of your package.json:
"signalrGen": "signalr-gen"
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago