Everyone performed admirably following the manual, here is the code snippet for WebSocketBroadcaster:
import {EventEmitter, Injectable} from "@angular/core";
@Injectable()
export class WebSocketBroadcaster {
ee: EventEmitter<any> = new EventEmitter<any>();
}
Here is the code for WebSocketService: link
Now let's bootstrap the application:
bootstrap(AppComponent, [
appRouterProviders,
disableDeprecatedForms(),
provideForms(),
WebSocketBroadcaster
])
This is the code snippet for the client component: link
The use of console.log(data)
in client.component is not functioning correctly.
However, when using
console.log(this.broadcaster.ee);
, we get the following output:https://i.sstatic.net/QPcNQ.png