Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-import axios ! #34

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading