wtt-connect 0.2.47 → 0.2.49
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/package.json +1 -1
- package/src/wtt-client.js +24 -7
package/package.json
CHANGED
package/src/wtt-client.js
CHANGED
|
@@ -195,18 +195,35 @@ export class WTTClient {
|
|
|
195
195
|
...(options.adapter ? { adapter: options.adapter } : {}),
|
|
196
196
|
...(options.model ? { model: options.model } : {}),
|
|
197
197
|
};
|
|
198
|
+
try {
|
|
199
|
+
const result = await this.action('typing', payload, 5000);
|
|
200
|
+
log('info', 'typing status sent via websocket', {
|
|
201
|
+
topicId,
|
|
202
|
+
state,
|
|
203
|
+
kind: payload.status_kind || '',
|
|
204
|
+
broadcast: result?.broadcast ?? '',
|
|
205
|
+
text: payload.status_text ? String(payload.status_text).slice(0, 80) : '',
|
|
206
|
+
});
|
|
207
|
+
return;
|
|
208
|
+
} catch (err) {
|
|
209
|
+
log('warn', 'websocket typing failed; trying HTTP fallback', { topicId, state, error: err?.message || err });
|
|
210
|
+
}
|
|
198
211
|
if (this.config.token) {
|
|
199
212
|
try {
|
|
200
|
-
await this.httpTyping(payload, options.timeoutMs || 5000);
|
|
213
|
+
const result = await this.httpTyping(payload, options.timeoutMs || 5000);
|
|
214
|
+
log('info', 'typing status sent via HTTP fallback', {
|
|
215
|
+
topicId,
|
|
216
|
+
state,
|
|
217
|
+
kind: payload.status_kind || '',
|
|
218
|
+
broadcast: result?.broadcast ?? '',
|
|
219
|
+
text: payload.status_text ? String(payload.status_text).slice(0, 80) : '',
|
|
220
|
+
});
|
|
201
221
|
return;
|
|
202
222
|
} catch (err) {
|
|
203
|
-
log('warn', '
|
|
223
|
+
log('warn', 'typing status dropped', { topicId, state, error: err?.message || err });
|
|
204
224
|
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
await this.action('typing', payload, 5000);
|
|
208
|
-
} catch (err) {
|
|
209
|
-
log('warn', 'typing status dropped', { topicId, state, error: err?.message || err });
|
|
225
|
+
} else {
|
|
226
|
+
log('warn', 'typing status dropped', { topicId, state, error: 'missing token for HTTP fallback' });
|
|
210
227
|
}
|
|
211
228
|
}
|
|
212
229
|
|