import { Component } from '@angular/core'; import { SocketService } from './socket/socket.service'; import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'rona-frontend'; onClickSocket() { this.socketService.send('test', {'user': 'USERNAME', 'payload': 'PAYLOAD TEST'}) } onClickApi() { this.httpService.get('http://localhost:5005/').subscribe(response => { console.log('REST API call returned: ', response); }); } /** * * @param socketService * @param httpService */ constructor(private socketService: SocketService, private httpService: HttpClient) { } }