You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Uma das maiores causas de instabilidades e alto consumo de memória ram pela biblioteca, está na sincronização de status postados pelos clientes.
Mensagens trocadas em conversas, utilizam pouca memória ram, pois é apenas texto, já os status são todos vídeos, portanto, um celular que possua por exemplo 5000 contatos salvos, recebe uma avalanche de status assim que conecta, jogando os recursos de memória ram lá em cima e por consequência trazendo instabilidade para biblioteca.
Describe the solution you'd like
Seria interessante adicionar uma opção na inicialização do client, para escolher se deseja ou não sincronizar os status.
Caso não deseje sincronizar os status, é necessário realizar as seguintes supressões:
Assim que conecta o chip, não deve puxar os status na sincronização inicial;
Quando o chip já está conectado, não deve receber os novos status que os contatos estão postando;
É importante manter a sincronização dos status que são postados pelo aparelho conectado, pois caso algum contato responda esse status, e ele não estiver sincronizado na biblioteca, não vai ser possível realizar a vinculação que a mensagem recebida é a resposta de um status.
Describe alternatives you've considered
Necessário seguir os critérios informados acima.
Additional context
Já consegui realizar uma parte disso, que é a supressão da sincronização inicial dos status, segue abaixo as alterações para isso:
/*!
* Copyright 2021 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { exportModule } from '../exportModule';
export interface HistorySyncNotification {
syncType: Number
}
export interface HistoryData {
historySyncNotification: HistorySyncNotification
}
/** @whatsapp 889877
* @whatsapp 889877 >= 2.2222.8
*/
export declare function handleHistorySyncNotification(args: HistoryData): Promise<any>;
exportModule(
exports,
{
handleHistorySyncNotification: 'handleHistorySyncNotification',
},
(m) => m.handleHistorySyncNotification
);
/*!
* Copyright 2021 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as webpack from '../../webpack';
import { wrapModuleFunction } from '../../whatsapp/exportModule';
import { handleHistorySyncNotification } from '../../whatsapp/functions';
webpack.onInjected(() => register());
function register() {
wrapModuleFunction(handleHistorySyncNotification, (func, ...args) => {
const [data] = args;
const dataString = JSON.stringify(data);
const parsedData = JSON.parse(dataString);
if (parsedData.historySyncNotification.syncType === 1) {
return new Promise(() => {
return;
});
}
return func(...args);
});
}
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Uma das maiores causas de instabilidades e alto consumo de memória ram pela biblioteca, está na sincronização de status postados pelos clientes.
Mensagens trocadas em conversas, utilizam pouca memória ram, pois é apenas texto, já os status são todos vídeos, portanto, um celular que possua por exemplo 5000 contatos salvos, recebe uma avalanche de status assim que conecta, jogando os recursos de memória ram lá em cima e por consequência trazendo instabilidade para biblioteca.
Describe the solution you'd like
Seria interessante adicionar uma opção na inicialização do client, para escolher se deseja ou não sincronizar os status.
Caso não deseje sincronizar os status, é necessário realizar as seguintes supressões:
Describe alternatives you've considered
Necessário seguir os critérios informados acima.
Additional context
Já consegui realizar uma parte disso, que é a supressão da sincronização inicial dos status, segue abaixo as alterações para isso:
wa-js/src/whatsapp/functions/handleHistorySyncNotification.ts
wa-js/src/chat/events/handleStatusNotifications.ts:
The text was updated successfully, but these errors were encountered: