2.4.2 • Published 5 months ago

rgrueneis-signalr-gen v2.4.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

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:

PropertyDescriptionDefault
analyzerUriURL to the backend where the data for the hubs is provided"http://localhost:5000/hubanalyzer"
relativeTargetPathfolder where the typescript classes are generated
typeangular or wpfangular
hubNameIf set, only the classes for this hub are generated
useHubSuffixInContractWPF only. If set, the namespace of the contract is expected to include "Hub", e.g. DemoHubContractsfalse
includeContractDtosNamespaceWPF only. If set, adds a using like using DemoContracts.Dtos;. Use it, if your Hub interface include a DTOfalse

Script

Add the following line to the scripts section of your package.json:

"signalrGen": "signalr-gen"
2.4.2

5 months ago

2.4.1

5 months ago

2.3.5

5 months ago

2.3.4

6 months ago

2.3.3

6 months ago

2.3.2

6 months ago

2.3.1

6 months ago

2.2.4

6 months ago

2.2.3

6 months ago

2.2.2

6 months ago

2.2.1

6 months ago

2.1.2

6 months ago

2.1.1

6 months ago

2.1.0

6 months ago

2.0.0

6 months ago

1.5.0

6 months ago

1.4.1

6 months ago

1.3.4

6 months ago

1.3.3

6 months ago

1.3.2

6 months ago

1.3.1

6 months ago

1.3.0

6 months ago

1.2.0

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago