-->
Page 1 of 3

ESPAsyncWebServer (AsyncWebSocket) ws.printf Doesn't Work ?

PostPosted: Sun Feb 02, 2020 12:21 pm
by sfranzyshen
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?

Re: ESPAsyncWebServer (AsyncWebSocket) ws.printf Doesn't Wor

PostPosted: Mon Feb 03, 2020 12:07 pm
by sfranzyshen
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.

Re: ESPAsyncWebServer (AsyncWebSocket) ws.printf Doesn't Wor

PostPosted: Mon Feb 03, 2020 3:23 pm
by RichardS
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

Re: ESPAsyncWebServer (AsyncWebSocket) ws.printf Doesn't Wor

PostPosted: Mon Feb 03, 2020 3:26 pm
by RichardS
OK I googled it.... I see what they are doing... its a special printf that works only on one "id"