Skip to content

Commit 82243ee

Browse files
authored
Merge pull request #34 from Adesin-fr/master
2 parents 4b86198 + 4ef97e9 commit 82243ee

File tree

2 files changed

+2549
-1924
lines changed

2 files changed

+2549
-1924
lines changed

js-src/Websocket.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AxiosResponse } from "axios";
22
import { Channel } from "./Channel";
3+
import axios from 'axios';
34

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

@@ -28,7 +29,11 @@ export class Websocket {
2829
private pingInterval: NodeJS.Timeout;
2930

3031
private connect(host: string): void {
31-
this.options.debug && console.log(LOG_PREFIX + ' Trying to connect...');
32+
if (!host) {
33+
this.options.debug && console.error(LOG_PREFIX + `Cannont connect without host !`);
34+
return;
35+
}
36+
this.options.debug && console.log(LOG_PREFIX + `Trying to connect to ${host}...` );
3237

3338
this.websocket = new WebSocket(host);
3439

@@ -57,7 +62,7 @@ export class Websocket {
5762
this.send(message);
5863

5964
this.buffer.splice(0, 1);
60-
};
65+
}
6166

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

0 commit comments

Comments
 (0)