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 @@
<br>
<mat-progress-spinner color="primary" mode="determinate" value="value">
</mat-progress-spinner>
<button (click)="move('left')">Test me</button>
</div>
import { Component, OnInit } from '@angular/core';
import {Router} from '@angular/router';
import {io} from 'socket.io-client';
import {environment} from '../../environments/environment';
@Component({
selector: 'app-error',
......@@ -10,27 +8,12 @@ import {environment} from '../../environments/environment';
})
export class ErrorComponent implements OnInit {
private socket: any;
constructor(private router: Router) {}
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 {
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 {
}
this.fillGamestatus();
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.startTimer();
......
......@@ -34,7 +34,10 @@ export class GuesserComponent implements OnInit {
this.sessionName = String(params.get('sessionName'));
this.team = String(params.get('team'));
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.startTimer();
......
......@@ -61,7 +61,10 @@ export class OverviewComponent implements OnInit {
return;
}
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();
});
}
......
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