Commit bd74510d authored by Dennis Willers's avatar Dennis Willers 🏀

TestFix

parent 5bddb764
Pipeline #334 passed with stages
in 5 minutes and 28 seconds
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<br> <br>
<mat-progress-spinner color="primary" mode="determinate" value="value"> <mat-progress-spinner color="primary" mode="determinate" value="value">
</mat-progress-spinner> </mat-progress-spinner>
<button (click)="move('left')">Test me</button>
</div> </div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {io} from 'socket.io-client';
import {environment} from '../../environments/environment';
@Component({ @Component({
selector: 'app-error', selector: 'app-error',
...@@ -10,27 +8,12 @@ import {environment} from '../../environments/environment'; ...@@ -10,27 +8,12 @@ import {environment} from '../../environments/environment';
}) })
export class ErrorComponent implements OnInit { export class ErrorComponent implements OnInit {
private socket: any;
constructor(private router: Router) {} constructor(private router: Router) {}
ngOnInit(): void { ngOnInit(): void {
this.socket = io(environment.tabuServerURL);
this.socket.disconnect();
this.listen();
} }
listen(): any {
this.socket.on('position', (data: any) => {
console.log('Listener:' , data);
});
}
toStartpage(): void { toStartpage(): void {
this.router.navigate(['']); this.router.navigate(['']);
} }
move(direction: string): any {
console.log('left: ', direction);
this.socket.emit('move', direction);
}
} }
...@@ -63,7 +63,10 @@ export class GameComponent implements OnInit { ...@@ -63,7 +63,10 @@ export class GameComponent implements OnInit {
} }
this.fillGamestatus(); this.fillGamestatus();
this.team = String(params.get('team')); this.team = String(params.get('team'));
this.socket = io(environment.tabuServerURL); this.socket = io(environment.tabuServerURL, {
// WARNING: in that case, there is no fallback to long-polling
transports: [ 'websocket' ] // or [ 'websocket', 'polling' ], which is the same thing
});
this.listen(); this.listen();
}); });
this.startTimer(); this.startTimer();
......
...@@ -34,7 +34,10 @@ export class GuesserComponent implements OnInit { ...@@ -34,7 +34,10 @@ export class GuesserComponent implements OnInit {
this.sessionName = String(params.get('sessionName')); this.sessionName = String(params.get('sessionName'));
this.team = String(params.get('team')); this.team = String(params.get('team'));
this.fillGamestatus(); this.fillGamestatus();
this.socket = io(environment.tabuServerURL); this.socket = io(environment.tabuServerURL, {
// WARNING: in that case, there is no fallback to long-polling
transports: [ 'websocket' ] // or [ 'websocket', 'polling' ], which is the same thing
});
this.listen(); this.listen();
}); });
this.startTimer(); this.startTimer();
......
...@@ -61,7 +61,10 @@ export class OverviewComponent implements OnInit { ...@@ -61,7 +61,10 @@ export class OverviewComponent implements OnInit {
return; return;
} }
this.getGameStatus(); this.getGameStatus();
this.socket = io(environment.tabuServerURL); this.socket = io(environment.tabuServerURL, {
// WARNING: in that case, there is no fallback to long-polling
transports: [ 'websocket' ] // or [ 'websocket', 'polling' ], which is the same thing
});
this.listen(); this.listen();
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment