|
|
@ -83,6 +83,19 @@ websockets::TestProtocol<Empty> uberclient_protocol{ |
|
|
|
}, |
|
|
|
// write (will always come after receive)
|
|
|
|
[](Empty& user, basic_websocket_info) -> std::string{ |
|
|
|
if(app->peeps){ |
|
|
|
app->peeps = false; |
|
|
|
std::string str; |
|
|
|
for(auto & u : app->people_online){ |
|
|
|
str += u->name; |
|
|
|
if(u != app->people_online.back()) |
|
|
|
str += ", "; |
|
|
|
} |
|
|
|
js::Object ret; |
|
|
|
ret["command"] = "peeps"; |
|
|
|
ret["data"] = to_json(str); |
|
|
|
return write_json(ret); |
|
|
|
} |
|
|
|
if(!app->offline_sim.lines_to_remove.empty()){ |
|
|
|
js::Object ret; |
|
|
|
ret["command"] = "remove lines"; |
|
|
@ -118,7 +131,7 @@ websockets::TestProtocol<Empty> uberclient_protocol{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(!app->offline_sim.lines_to_add.empty() || !app->offline_sim.lines_to_remove.empty()){ |
|
|
|
if(app->peeps || !app->offline_sim.lines_to_add.empty() || !app->offline_sim.lines_to_remove.empty()){ |
|
|
|
request_write(binfo); |
|
|
|
} |
|
|
|
} |
|
|
|