src/server/daemon/websocket.c

changeset 155
36cd2e280386
parent 153
85320d8b5d5c
child 161
aadda87bad1b
equal deleted inserted replaced
154:6394ce09889a 155:36cd2e280386
302 302
303 /* ------------------------------ public API ------------------------------*/ 303 /* ------------------------------ public API ------------------------------*/
304 304
305 NSAPI_PUBLIC int websocket_send_text(SYS_NETFD csd, char *msg, size_t len) { 305 NSAPI_PUBLIC int websocket_send_text(SYS_NETFD csd, char *msg, size_t len) {
306 char frame[WS_FRAMEHEADER_BUFLEN]; 306 char frame[WS_FRAMEHEADER_BUFLEN];
307 frame[0] = 0b10000001; 307 frame[0] = 129; // 0b10000001
308 size_t hlen; 308 size_t hlen;
309 if(len < 126) { 309 if(len < 126) {
310 frame[1] = (char)len; 310 frame[1] = (char)len;
311 hlen = 2; 311 hlen = 2;
312 } else if(len < 65536) { 312 } else if(len < 65536) {

mercurial