0.0.6 • Published 3 years ago
generic-signalr-service v0.0.6
Dependency
This library was created by Angular version 15
Install
npm install generic-signalr-service
npm i @microsoft/signalr
Use
You have to call SignalRService in your constructor
Example
constructor(private _signalR: SignalRService){
this._signalR.start("http://localhost:7014/message-hub", ()=> callBack());
}
callBack(){
//methods.
}
Methods
This service have two methods.
invoke
invoke(procedureName: string, successCallBack?: (value: any) => void, errorCallBack?: (error: any) => void) {
this.connection.invoke(procedureName)
.then(successCallBack)
.catch(errorCallBack)
}
on
on(procedureName: string, callBack: (...message: any) => void) {
this.connection.on(procedureName, callBack)
}