Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By sfranzyshen
#85532 I'm trying to use
Code: Select allws.printf(id, "%s", cmdString.c_str());

but nothing is being received at the client ... it works fine when I replace ws.printf() function with the ws.printfAll() function ... i'm able to use client->printf() while in the event handler ...
Code: Select allAsyncWebSocket ws("/ws");
void processCommand(String cmdString, uint32_t id);
processCommand(msg, client->id());
ws.printf(id, "%s", cmdString.c_str());      <-- Doesn't work
ws.printfAll("%s", cmdString.c_str());       <-- Works


am I missing something?
User avatar
By sfranzyshen
#85538
sfranzyshen wrote:I'm trying to use
Code: Select allws.printf(id, "%s", cmdString.c_str());

but nothing is being received at the client ... it works fine when I replace ws.printf() function with the ws.printfAll() function ... i'm able to use client->printf() while in the event handler ...
Code: Select allAsyncWebSocket ws("/ws");
void processCommand(String cmdString, uint32_t id);
processCommand(msg, client->id());
ws.printf(id, "%s", cmdString.c_str());      <-- Doesn't work
ws.printfAll("%s", cmdString.c_str());       <-- Works


am I missing something?


Has this been a problem since 2016? #56 ... If the problem wasn't addressed or fixed ... then why the hell does the issue get closed and forgotten? Stop wasting peoples time ... at very least make a post in the documentation that there is a problem and that this function is borked!!! In searching github not a single repository uses ws.printf() ... they all use ws.printfAll() ... so rather than fix the problem ... since you obviously won't or can't ... why don't you just remove the references to the function from the documentation ... and save people a bunch of time trying to make crap code work.
User avatar
By RichardS
#85539 Might be barking up the wrong tree here, but I have never seen printf() that starts with an integer argument.... why the leading int in the function call?? its typically always a char* type thing....

RichardS
User avatar
By RichardS
#85540 OK I googled it.... I see what they are doing... its a special printf that works only on one "id"