mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: retries,acktimeout configuration socketio
This commit is contained in:
@@ -293,17 +293,23 @@ const ChatProvider: React.FC<{
|
||||
: OutgoingMessageState.sending,
|
||||
);
|
||||
setMessage("");
|
||||
const sentMessage = await socketCtx.socket.post<TMessage>(
|
||||
`/webhook/${config.channel}/`,
|
||||
{
|
||||
data: {
|
||||
...data,
|
||||
author: data.author ?? participants[1].id,
|
||||
try {
|
||||
// when the request timeout it throws exception & break frontend
|
||||
const sentMessage = await socketCtx.socket.post<TMessage>(
|
||||
`/webhook/${config.channel}/`,
|
||||
{
|
||||
data: {
|
||||
...data,
|
||||
author: data.author ?? participants[1].id,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
);
|
||||
|
||||
handleNewIOMessage(sentMessage.body);
|
||||
handleNewIOMessage(sentMessage.body);
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error("Unable to subscribe user", error);
|
||||
}
|
||||
};
|
||||
const handleSubscription = useCallback(
|
||||
async (firstName?: string, lastName?: string) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Hexastack. All rights reserved.
|
||||
* Copyright © 2025 Hexastack. All rights reserved.
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
|
||||
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
|
||||
|
||||
@@ -29,19 +29,19 @@ export class SocketIoClient {
|
||||
*/
|
||||
static defaultConfig: SocketIoClientConfig = {
|
||||
// Socket options
|
||||
ackTimeout: 1000,
|
||||
// auth: undefined,
|
||||
retries: 3,
|
||||
|
||||
// Manager options
|
||||
autoConnect: true,
|
||||
// parser: undefined,
|
||||
// randomizationFactor:0.5,
|
||||
randomizationFactor: 0.5,
|
||||
reconnection: true,
|
||||
reconnectionAttempts: 100,
|
||||
reconnectionDelay: 1000,
|
||||
reconnectionDelayMax: 5000,
|
||||
timeout: 20000,
|
||||
retries: 0,
|
||||
ackTimeout: 15_000,
|
||||
|
||||
// Low Level Options
|
||||
addTrailingSlash: true, // eg: https://domain.path/ => https://domain.path/
|
||||
@@ -154,6 +154,7 @@ export class SocketIoClient {
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Request failed with status code ${response.statusCode}: ${JSON.stringify(
|
||||
response.body,
|
||||
|
||||
Reference in New Issue
Block a user