// Copyright (C) 2018 Avatao.com Innovative Learning Kft. // All Rights Reserved. See LICENSE file for details. import { Component, OnInit } from '@angular/core'; import { WebSocketService } from '../services/websocket.service'; @Component({ selector: 'app-testmessager', templateUrl: './testmessenger.component.html', styleUrls: ['./testmessenger.component.scss'] }) export class TestmessengerComponent implements OnInit { messageStr = `{\n "key": "",\n "data": {},\n "trigger": ""\n}`; constructor(private webSocketService: WebSocketService) {} ngOnInit() { this.webSocketService.connect(); this.webSocketService.observeKey('').subscribe(); } sendTestMessage() { const jsonObject = JSON.parse(this.messageStr); this.webSocketService.sendJSON(jsonObject); } }