Skip to content

How to send consecutive data? #1456

@Mike4Feet

Description

@Mike4Feet

Hi,
Fisrt of all,My english is very poor,I sincerely hope you can understand what i wrote and give me some precious advice.

I wanna send some consecutive message(like video/audio data).
pseudocode is as follows:

.message = [](auto*ws, std::string_view message, uWS::OpCode opCode) {
    while(flag) {
        ws->send(std::string_view(videoData(), dataSize()), OpCode::BINARY);
    }
},
.close = [](auto *ws/*ws*/, int /*code*/, std::string_view /*message*/) {
    flag = false;
}

I know the library is single threaded, so when i send consecutive data to client in a while loop, I don't know when the client close,and 'flag = false' is unreachable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions