Skip to content

Commit

Permalink
Fixed additional issues which prevented ACE to work
Browse files Browse the repository at this point in the history
  • Loading branch information
frankkopp committed Dec 28, 2022
1 parent 18f7db2 commit c53d3aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,19 @@ class A320_Neo_CDU_MainDisplay extends FMCMainDisplay {
mcduServerClientEventHandler(event) {
switch (event.type) {
case 'open': {
console.log(`[MCDU] Websocket connection to SimBridge opened. (${SimBridgeClient.McduServerClient.url})`);
console.log(`[MCDU] Websocket connection to SimBridge opened. (${SimBridgeClient.McduServerClient.url()})`);
(new NXNotifManager).showNotification({title: "MCDU CONNECTED",
message: "A32NX MCDU successfully connected to SimBridge MCDU Server.", timeout: 5000});
this.sendToMcduServerClient("mcduConnected");
this.sendUpdate();
break;
}
case 'close': {
console.log(`[MCDU] Websocket connection to SimBridge closed. (${SimBridgeClient.McduServerClient.url})`);
console.log(`[MCDU] Websocket connection to SimBridge closed. (${SimBridgeClient.McduServerClient.url()})`);
break;
}
case 'error': {
console.log(`[MCDU] Websocket connection to SimBridge error. (${SimBridgeClient.McduServerClient.url}): ${event.get()}`);
console.log(`[MCDU] Websocket connection to SimBridge error. (${SimBridgeClient.McduServerClient.url()}): ${event.get()}`);
break;
}
case 'message': {
Expand Down
6 changes: 3 additions & 3 deletions src/simbridge-client/src/components/McduServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { ClientState } from './ClientState';
* Class to communicate with the SimBridge MCDU server
*/
export class McduServerClient {
public static port = () => NXDataStore.get('CONFIG_SIMBRIDGE_PORT', '8380');
public static port = ():string => NXDataStore.get('CONFIG_SIMBRIDGE_PORT', '8380');

public static url: string = `ws://127.0.0.1:${this.port()}/interfaces/v1/mcdu`.replace(/\s+/g, '');
public static url = ():string => `ws://127.0.0.1:${this.port()}/interfaces/v1/mcdu`.replace(/\s+/g, '');

private state: ClientState = ClientState.getInstance();

Expand All @@ -32,7 +32,7 @@ export class McduServerClient {
this.disconnect();

// Connect web socket
this.socket = new WebSocket(McduServerClient.url);
this.socket = new WebSocket(McduServerClient.url());

// Setup up event handler from the caller
if (eventHandler && typeof (eventHandler) === 'function') {
Expand Down

0 comments on commit c53d3aa

Please sign in to comment.