Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this being Maintained? #1151

Open
LennoxP90 opened this issue Nov 6, 2024 · 2 comments
Open

Is this being Maintained? #1151

LennoxP90 opened this issue Nov 6, 2024 · 2 comments

Comments

@LennoxP90
Copy link

there is 67 pull requests as of this issue creation last release was 4 years ago, is there anyone with the ability to maintain this project has it been abandoned. I have had some intermittent crashing when my clients are disconnecting and reconnecting. Using this library as a server.

@abhinavdhamaniya-jm
Copy link

@LennoxP90 i am not a maintainer but i faced the same issue as you, i fixed it by adding a thread lock over the connections loop

std::mutex connectionsMutex;
void MyWebSocket::broadcastLoop() {
    while (running) {
        auto message = "test";

        std::lock_guard lock(connectionsMutex);
        for (const auto &connection: activeConnections) {
            try {
                webSocketServer.send(connection, message, websocketpp::frame::opcode::text);
            } catch (const std::exception &exc) {
                std::cerr << "WebSocket send error: " << exc.what() << std::endl;
            }
        }
    }
}


void MyWebSocket::onOpen(const connectionHdl &hdl) {
    std::lock_guard lock(connectionsMutex);
    activeConnections.insert(hdl);
    std::cout << "Client connected, total clients: " << activeConnections.size() << std::endl;
}

void MyWebSocket::onClose(const connectionHdl &hdl) {
    std::lock_guard lock(connectionsMutex);
    activeConnections.erase(hdl);
    std::cout << "Client disconnected, total clients: " << activeConnections.size() << std::endl;
}

@LennoxP90
Copy link
Author

this is not the case for me I use the built in connection handle upgrader I do not maintain the list of connections myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants