Added flask support #70 #75 #71

Merged
edraft merged 107 commits from #70 into 0.3 2022-11-05 13:55:42 +01:00
Showing only changes of commit 24a3a48478 - Show all commits

View File

@ -7,7 +7,7 @@ import io from "socket.io-client";
import { MessageService } from "primeng/api";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class SocketService {
private socket: any;
@ -17,36 +17,34 @@ export class SocketService {
private settingsService: SettingsService,
private toastService: ToastService,
private spinnerService: SpinnerService,
private messageService: MessageService,
private messageService: MessageService
) {
}
startSocket() {
this.socket = io(`${this.settingsService.getApiURL()}`, {path: '/api/socket.io'})
this.socket.on('connect', () => {
this.socket = io(`${this.settingsService.getApiURL()}`, { path: "/api/socket.io" });
this.socket.on("connect", () => {
if (this.disconnected) {
if (this.spinnerService.showSpinnerState) {
this.spinnerService.hideSpinner();
const options: ToastOptions = {
closable: false
};
this.messageService.clear();
this.toastService.info("Server verbunden", "Die Verbindung zum Server konnte hergestellt werden.", options);
}
this.spinnerService.hideSpinner();
const options: ToastOptions = {
closable: false
};
this.messageService.clear();
this.toastService.info("Server verbunden", "Die Verbindung zum Server konnte hergestellt werden.", options);
}
this.disconnected = false;
console.log('Connected!')
console.info("Connected!");
});
this.socket.on('connect_error', (err: Error) => {
this.socket.on("connect_error", (err: Error) => {
if (this.disconnected) {
this.spinnerService.showSpinner();
return;
}
console.warn("Connect error!");
this.disconnected = true;
const options: ToastOptions = {
sticky: true,
closable: false
@ -56,8 +54,13 @@ export class SocketService {
console.error(err.toString());
});
this.socket.on('disconnect', () => {
console.log('Disconnected!');
this.socket.on("disconnect", () => {
if (this.disconnected) {
return;
}
console.warn("Disconnected!");
this.disconnected = true;
const options: ToastOptions = {
sticky: true,
closable: false