Fork of https://os.mbed.com/teams/mbed_example/code/WebSocketClient/ Update to MbedOS6
Diff: Websocket.cpp
- Revision:
- 10:91e447f28540
- Parent:
- 9:efa2c147bee1
- Child:
- 11:9ee267dafdd7
--- a/Websocket.cpp Thu Mar 16 21:10:27 2017 +0000 +++ b/Websocket.cpp Sat May 22 06:57:45 2021 +0000 @@ -123,9 +123,9 @@ bool Websocket::connect() { char cmd[200]; - while (socket.connect(host, port) < 0) { + while (socket.connect(SocketAddress(host, port)) < 0) { ERR("Unable to connect to (%s) on port (%d)", host, port); - wait(0.2); + ThisThread::sleep_for(200ms); return false; } @@ -240,7 +240,7 @@ // read the opcode tmr.start(); while (true) { - if (tmr.read() > 3) { + if (chrono::duration_cast<chrono::milliseconds>(tmr.elapsed_time()).count() > 3) { DBG("timeout ws\r\n"); return false; }