Rename testmessager -> testmessenger

This commit is contained in:
Kristóf Tóth
2018-03-05 17:12:06 +01:00
parent 1fddd234f2
commit fc5ed3f06f
5 changed files with 7 additions and 7 deletions

View File

@ -0,0 +1,2 @@
<textarea [(ngModel)]="messageStr" cols="33" rows="7"></textarea><br>
<button class="btn btn-primary" (click)="sendTestMessage()">Send</button>

View File

@ -0,0 +1,23 @@
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 = `{"key": "",\n"data": {}}`;
constructor(private webSocketService: WebSocketService) {}
ngOnInit() {
this.webSocketService.connect();
this.webSocketService.observeKey('').subscribe();
}
sendTestMessage() {
const jsonObject = JSON.parse(this.messageStr);
this.webSocketService.send(jsonObject['key'], jsonObject['data']);
}
}