1) supplied [pollFriendsList]="true" in template
2) in component.ts, userId: string = " " or whatever a string like "xxxxxx"
3) make sure SignalR connect to hub - connected !
4) remove complaint Observable.throw by changing it to throwError in listFriends() method
listFriends(): Observable<ParticipantResponse[]> {
// List connected users to show in the friends list
// Sending the userId from the request body as this is just a demo
return this.http
.post(${SignalRAdapter.serverBaseUrl}listFriends, { currentUserId: this.userId })
.pipe(
map((res: any) => res),
catchError((error: any) => throwError(error.error || 'Server error'))
);
}
5) ng serve to my project
Actual Error:
at CallSite.Target(Closure , CallSite , Object …als\API\Middleware\ExceptionMiddleware.cs:line 28", statusCode: 500, message: "'System.Text.Json.JsonElement' does not contain a definition for 'currentUserId'
Questions:
1) where and how currentUserId is defined in the post request
2) how does the listFriend() get the userId?
after integrated ng-chat to my angular app
1) supplied [pollFriendsList]="true" in template 2) in component.ts, userId: string = " " or whatever a string like "xxxxxx" 3) make sure SignalR connect to hub - connected ! 4) remove complaint Observable.throw by changing it to throwError in listFriends() method
listFriends(): Observable<ParticipantResponse[]> { // List connected users to show in the friends list // Sending the userId from the request body as this is just a demo return this.http .post(
${SignalRAdapter.serverBaseUrl}listFriends
, { currentUserId: this.userId }) .pipe( map((res: any) => res), catchError((error: any) => throwError(error.error || 'Server error')) ); }5) ng serve to my project
Actual Error:
at CallSite.Target(Closure , CallSite , Object …als\API\Middleware\ExceptionMiddleware.cs:line 28", statusCode: 500, message: "'System.Text.Json.JsonElement' does not contain a definition for 'currentUserId'
Questions: 1) where and how currentUserId is defined in the post request 2) how does the listFriend() get the userId?