Our current SDR online list: https://sdr-list.xyz/

Something wrong with the chatbox...Chatbox code fix!!

Started by Bas ON5HB, Nov 10, 2024, 12:37 PM

Previous topic - Next topic

Bas ON5HB

My websdr crashed this morning, and wouldn't restart.

Thank you for using PhantomSDR+, you are supporting the Development of an Open-Source WebSDR Project ♥
Using OpenCL
Using OpenCL platform: Intel(R) OpenCL Graphics
Using OpenCL device: Intel(R) HD Graphics 630
Markers updated.
Waterfall is sent every 1 FFTs
terminate called after throwing an instance of 'websocketpp::exception'
  what():  A payload contained invalid data
Afgebroken (geheugendump gemaakt)

Only after deleting chat.txt it would work again.


Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Bas ON5HB

#1
I went into the code and changed the number of chatlines from 100 to 20....let's see if it works, in src/chat.cpp

New code:

void ChatClient::store_chat_message(const std::string& message) {
    if(chat_messages_history.size() >= 20) {
        chat_messages_history.pop_front();
    }
    else
    chat_messages_history.push_back(message);
    save_chat_history();
}

and:

void ChatClient::load_chat_history() {
    std::ifstream file("chat_history.txt");
    std::string line;
    while (std::getline(file, line) && chat_messages_history.size() < 20) {
        chat_messages_history.push_back(line);
    }
    file.close();
}

Then go into build and run: ninja

As this should reduce the chat max messages to 20 instead of 100, I THINK the chat has too many characters for the websocket to cope.

With a little luck this will solve the crashing over chatting ;)

Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Bas ON5HB

Have been testing and the code works...

Maybe you want to keep 100 lines....then only insert ELSE like in the first code and run ninja.

Because the ELSE was missing, it kept growing ;D
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Phil - NY4Q

I like the idea of only 20 lines of chat. Thanks Bas.

Bas ON5HB

After 24 hours the chatbox-file is still 20 lines ;D
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

magicint1337

Will include this in the next commit / version
Maintainer and Developer of PhantomSDR-Plus

Powered by EzPortal