<commit_before>#include "clientconnection.h"

ClientConnection::ClientConnection(QWebSocket *socket, QObject *parent) :
     QObject(parent),m_socket(socket), m_workerThread(new QThread()), m_worker( new ClientWorker() )
{     
    connect(m_workerThread, SIGNAL(finished()),
            m_workerThread, SLOT(deleteLater()));

    // socket disconnected
    connect(m_socket, &QWebSocket::disconnected, [=](){
        emit disconnected();
    });

    // when a frame can be send to client
    connect(m_worker, SIGNAL(binnaryMessageReadyToSend(QByteArray)), this, SLOT(sendData(QByteArray)));

    // increment recived data size
    connect(m_socket, &QWebSocket::binaryMessageReceived, [&](const QByteArray &frame){
        timer.restart();
        m_bytesRecived += frame.size();
    });

    // frame recived can be passed to worker thread
    connect(m_socket, SIGNAL(binaryMessageReceived(QByteArray)),
            m_worker, SLOT(processBinnaryMessage(QByteArray)), Qt::QueuedConnection);

    connect(m_socket, &QWebSocket::disconnected, [&](){
        emit disconnected();
        ///TODO save all panding values in database (last group, item etc)
    });

    m_worker->moveToThread(m_workerThread);
    m_workerThread->start();<commit_msg>add slot for showing connection status change<commit_after>#include "clientconnection.h"

ClientConnection::ClientConnection(QWebSocket *socket, QObject *parent) :
     QObject(parent),m_socket(socket), m_workerThread(new QThread()), m_worker( new ClientWorker() )
{     
    connect(m_workerThread, SIGNAL(finished()),
            m_workerThread, SLOT(deleteLater()));

    // socket disconnected
    connect(m_socket, &QWebSocket::disconnected, [=](){
        emit disconnected();
    });

    // when a frame can be send to client
    connect(m_worker, SIGNAL(binnaryMessageReadyToSend(QByteArray)), this, SLOT(sendData(QByteArray)));

    // increment recived data size
    connect(m_socket, &QWebSocket::binaryMessageReceived, [&](const QByteArray &frame){
        timer.restart();
        m_bytesRecived += frame.size();
    });

    // frame recived can be passed to worker thread
    connect(m_socket, SIGNAL(binaryMessageReceived(QByteArray)),
            m_worker, SLOT(processBinnaryMessage(QByteArray)), Qt::QueuedConnection);

    connect(m_socket, &QWebSocket::disconnected, [&](){
        emit disconnected();
        ///TODO save all panding values in database (last group, item etc)
    });

    connect(m_socket, &QWebSocket::stateChanged, [=](QAbstractSocket::SocketState state ){
        qDebug() << m_socket->peerAddress().toString() << " : state changed to :" << state;
    });

    m_worker->moveToThread(m_workerThread);
    m_workerThread->start();
{'fraction_non_alphanumeric': 0.13262307127112416, 'fraction_numerical': 0.0, 'mean_word_length': 4.099250936329588, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4503009', 'n_tokens_mistral': 810, 'n_tokens_neox': 782, 'n_words': 167}