Some small changes
parent
41876e273c
commit
1610fd9d51
|
@ -21,6 +21,7 @@ export type LocalAgent = {
|
|||
}
|
||||
|
||||
export interface ClientServiceConfig {
|
||||
getServiceHost() : string;
|
||||
getSelectedLocaleUrl() : string | null;
|
||||
getSessionType() : ClientSessionType;
|
||||
generateHostInfo() : LocalAgent;
|
||||
|
@ -51,7 +52,7 @@ export class ClientServices {
|
|||
this.initializeLocaleId = 0;
|
||||
|
||||
this.sessionInitialized = false;
|
||||
this.connection = new ClientServiceConnection(5000);
|
||||
this.connection = new ClientServiceConnection(config.getServiceHost(), 5000);
|
||||
this.connection.events.on("notify_state_changed", event => {
|
||||
if(event.newState !== "connected") {
|
||||
if(this.sessionInitialized) {
|
||||
|
|
|
@ -22,6 +22,8 @@ export class ClientServiceConnection {
|
|||
readonly events: Registry<ClientServiceConnectionEvents>;
|
||||
readonly reconnectInterval: number;
|
||||
|
||||
private readonly serviceHost: string;
|
||||
|
||||
private reconnectTimeout: any;
|
||||
private connectionState: ConnectionState;
|
||||
private connection: WebSocket;
|
||||
|
@ -29,7 +31,8 @@ export class ClientServiceConnection {
|
|||
private pendingCommands: {[key: string]: PendingCommand} = {};
|
||||
private notifyHandler: {[key: string]: ((event) => void)[]} = {};
|
||||
|
||||
constructor(reconnectInterval: number) {
|
||||
constructor(serviceHost: string, reconnectInterval: number) {
|
||||
this.serviceHost = serviceHost;
|
||||
this.events = new Registry<ClientServiceConnectionEvents>();
|
||||
this.reconnectInterval = reconnectInterval;
|
||||
}
|
||||
|
@ -59,12 +62,7 @@ export class ClientServiceConnection {
|
|||
|
||||
this.setState("connecting");
|
||||
|
||||
let address;
|
||||
address = "client-services.teaspeak.de:27791";
|
||||
address = "localhost:1244";
|
||||
//address = "192.168.40.135:1244";
|
||||
|
||||
this.connection = new WebSocket(`wss://${address}/ws-api/v${kApiVersion}`);
|
||||
this.connection = new WebSocket(`wss://${this.serviceHost}/ws-api/v${kApiVersion}`);
|
||||
this.connection.onclose = event => {
|
||||
clientServiceLogger.logTrace("Lost connection to statistics server (Connection closed). Reason: %s", event.reason ? `${event.reason} (${event.code})` : event.code);
|
||||
this.handleConnectionLost();
|
||||
|
@ -214,7 +212,7 @@ export class ClientServiceConnection {
|
|||
const unregisterHandler = () => {
|
||||
const index = handlers.indexOf(handler);
|
||||
if(index !== -1) {
|
||||
handlers.remove(handler);
|
||||
handlers.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class GeoLocationProvider {
|
|||
|
||||
this.cachedInfo = info.info;
|
||||
} catch (error) {
|
||||
clientServiceLogger.logTrace(tr("Failed to load geo resolve cache: %o"), error);
|
||||
clientServiceLogger.logTrace(tr("Failed to load geo resolve cache:\n%o"), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class GeoLocationProvider {
|
|||
} as GeoLocationCache));
|
||||
return info;
|
||||
} catch (error) {
|
||||
clientServiceLogger.logTrace(tr("Geo resolver %s failed: %o. Trying next one."), resolver.name(), error);
|
||||
clientServiceLogger.logTrace(tr("Geo resolver %s failed. Trying next one:\n%o"), resolver.name(), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue