Skip to content

Commit

Permalink
import axios must not be removed !
Browse files Browse the repository at this point in the history
If the caller project doesn't have it as a dependecy, it won't work !
  • Loading branch information
ludovic committed Nov 28, 2024
1 parent 07771d8 commit 4ef97e9
Show file tree
Hide file tree
Showing 2 changed files with 2,549 additions and 1,924 deletions.
9 changes: 7 additions & 2 deletions js-src/Websocket.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AxiosResponse } from "axios";
import { Channel } from "./Channel";
import axios from 'axios';

export type Options = { authEndpoint: string, host: string, bearerToken: string, auth: any, debug: boolean };

Expand Down Expand Up @@ -28,7 +29,11 @@ export class Websocket {
private pingInterval: NodeJS.Timeout;

private connect(host: string): void {
this.options.debug && console.log(LOG_PREFIX + ' Trying to connect...');
if (!host) {
this.options.debug && console.error(LOG_PREFIX + `Cannont connect without host !`);
return;
}
this.options.debug && console.log(LOG_PREFIX + `Trying to connect to ${host}...` );

this.websocket = new WebSocket(host);

Expand Down Expand Up @@ -57,7 +62,7 @@ export class Websocket {
this.send(message);

this.buffer.splice(0, 1);
};
}

// Register events only once connected, or they won't be registered if connection failed/lost

Expand Down
Loading

0 comments on commit 4ef97e9

Please sign in to comment.