wtt-connect 0.2.48 → 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 +17 -14
package/package.json
CHANGED
package/src/wtt-client.js
CHANGED
|
@@ -195,10 +195,23 @@ 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
213
|
const result = await this.httpTyping(payload, options.timeoutMs || 5000);
|
|
201
|
-
log('info', 'typing status sent via HTTP', {
|
|
214
|
+
log('info', 'typing status sent via HTTP fallback', {
|
|
202
215
|
topicId,
|
|
203
216
|
state,
|
|
204
217
|
kind: payload.status_kind || '',
|
|
@@ -207,20 +220,10 @@ export class WTTClient {
|
|
|
207
220
|
});
|
|
208
221
|
return;
|
|
209
222
|
} catch (err) {
|
|
210
|
-
log('warn', '
|
|
223
|
+
log('warn', 'typing status dropped', { topicId, state, error: err?.message || err });
|
|
211
224
|
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const result = await this.action('typing', payload, 5000);
|
|
215
|
-
log('info', 'typing status sent via websocket', {
|
|
216
|
-
topicId,
|
|
217
|
-
state,
|
|
218
|
-
kind: payload.status_kind || '',
|
|
219
|
-
broadcast: result?.broadcast ?? '',
|
|
220
|
-
text: payload.status_text ? String(payload.status_text).slice(0, 80) : '',
|
|
221
|
-
});
|
|
222
|
-
} catch (err) {
|
|
223
|
-
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' });
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
229
|
|