mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
parent
be5d42baba
commit
2f6c018b7a
4 changed files with 19 additions and 32 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { ServerStatus, StatusEnum, WebSocketConnectOptions } from 'types';
|
||||
import { StatusEnum, WebSocketConnectOptions } from 'types';
|
||||
|
||||
import { ProtobufService } from './services/ProtobufService';
|
||||
import { WebSocketService } from './services/WebSocketService';
|
||||
|
|
@ -37,6 +37,7 @@ export class WebClient {
|
|||
};
|
||||
|
||||
public options: WebSocketConnectOptions;
|
||||
public status: StatusEnum;
|
||||
|
||||
public connectionAttemptMade = false;
|
||||
|
||||
|
|
@ -45,10 +46,6 @@ export class WebClient {
|
|||
this.protobuf.handleMessageEvent(message);
|
||||
});
|
||||
|
||||
this.socket.statusChange$.subscribe((status: ServerStatus) => {
|
||||
this.handleStatusChange(status);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
console.log(this);
|
||||
}
|
||||
|
|
@ -68,12 +65,8 @@ export class WebClient {
|
|||
this.socket.disconnect();
|
||||
}
|
||||
|
||||
public updateStatus(status: StatusEnum, description: string) {
|
||||
this.socket.updateStatus(status, description);
|
||||
}
|
||||
|
||||
public handleStatusChange({ status, description }: ServerStatus) {
|
||||
SessionPersistence.updateStatus(status, description);
|
||||
public updateStatus(status: StatusEnum) {
|
||||
this.status = status;
|
||||
|
||||
if (status === StatusEnum.DISCONNECTED) {
|
||||
this.protobuf.resetCommands();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue