Skip to content

Commit 058bbdc

Browse files
authored
feat: dynamic import of socketio client (#173)
1 parent eb9b9a5 commit 058bbdc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

source/event_hub.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// :copyright: Copyright (c) 2016 ftrack
22
import { v4 as uuidV4 } from "uuid";
33
import loglevel from "loglevel";
4-
import io from "./simple_socketio.js";
54
import { Event } from "./event.js";
65
import {
76
EventServerConnectionTimeoutError,
@@ -10,7 +9,7 @@ import {
109
NotUniqueError,
1110
} from "./error.js";
1211
import { Data } from "./types.js";
13-
12+
import type io from "./simple_socketio.js";
1413
interface BaseActionData {
1514
selection: Array<{
1615
entityId: string;
@@ -178,7 +177,9 @@ export class EventHub {
178177
}
179178

180179
/** Connect to the event server. */
181-
connect(): void {
180+
async connect(): Promise<void> {
181+
const simple_socketio = await import("./simple_socketio.js");
182+
const io = simple_socketio.default;
182183
this._socketIo = io.connect(this._serverUrl, this._apiUser, this._apiKey);
183184
this._socketIo.on("connect", this._onSocketConnected);
184185
this._socketIo.on("ftrack.event", this._handle);

0 commit comments

Comments
 (0)