#include "extmod/moduwebsocket.h"
#if MICROPY_PY_UWEBSOCKET
-
+#include "mperrno.h"
+#include "mphal.h"
#include "helios_debug.h"
#define QPY_WS_LOG(msg, ...) custom_log("websocket", msg, ##__VA_ARGS__)
int to_recv = 0;
size_t sz = self->buf[1] & 0x7f;
+ //mp_printf(&mp_plat_print, "[uwebsocket] websocket_read sz = %d \r\n", sz);
if (sz == 126) {
// Msg size is next 2 bytes
to_recv += 2;
if ((self->buf_pos & 3) == 2) {
// First two bytes are message length
self->msg_sz = (self->buf[0] << 8) | self->buf[1];
+ mp_printf(&mp_plat_print, "[uwebsocket] websocket_read FRAME_OPT self->buf:%02X %02X \r\n",self->buf[0],self->buf[1]);
}
if (self->buf_pos >= 4) {
// Last 4 bytes is mask
size_t sz = MIN(size, self->msg_sz);
out_sz = stream_p->read(self->sock, buf, sz, errcode);
+ mp_printf(&mp_plat_print, "[uwebsocket] websocket_read CONTROL sz=%d,out_sz=%d,size=%d\r\n", sz,out_sz,size);
if (out_sz == 0 || out_sz == MP_STREAM_ERROR) {
return out_sz;
}