You can't write code that blocks waiting for input. It needs to use callbacks.
Personally I'd figure out which bit of the current module is slow (probably the masking) and implement just that part.
But if you did want to implement a WS module you'd be better off adding the functionality to
socketserver.cas a new type of socket.
I try you suggestion, result is here:
ESP32 module, WIFI connected.
In C native code , I send datas to a server by a socket connection.
The server receives the data correctly, then it sends a response string "hello client" to ESP32.
I use waitForInput to detect response data, but it always return FASLE.
And, should I use the following function to receive data?