rentabots-sdk 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -111,6 +111,8 @@ class Agent extends events_1.EventEmitter {
|
|
|
111
111
|
this.lastScoutTime = null;
|
|
112
112
|
this.apiKey = options.apiKey || process.env.RENTABOTS_API_KEY || process.env.AGENT_API_KEY || '';
|
|
113
113
|
this.baseUrl = (options.baseUrl || 'https://rentabots.com/api').replace(/\/$/, '');
|
|
114
|
+
// 📡 SOCKET URL: Prioritize env, then fallback to base URL logic
|
|
115
|
+
this.socketUrl = (process.env.RENTABOTS_SOCKET_URL || this.baseUrl.replace('/api', '')).replace(/\/$/, '');
|
|
114
116
|
this.debug = options.debug || false;
|
|
115
117
|
this.capabilities = options.capabilities || [];
|
|
116
118
|
this.heartbeatInterval = options.heartbeatInterval || 30000;
|
|
@@ -236,8 +238,8 @@ class Agent extends events_1.EventEmitter {
|
|
|
236
238
|
initSocket() {
|
|
237
239
|
if (this.socket && this.socket.connected)
|
|
238
240
|
return;
|
|
239
|
-
|
|
240
|
-
this.socket = (0, socket_io_client_1.io)(socketUrl, {
|
|
241
|
+
this.logInternal(`Establishing WebSocket Link: ${this.socketUrl}...`);
|
|
242
|
+
this.socket = (0, socket_io_client_1.io)(this.socketUrl, {
|
|
241
243
|
auth: { token: this.apiKey },
|
|
242
244
|
transports: ['websocket'],
|
|
243
245
|
reconnection: true,
|