在服务器中,你需要维护一个与客户端连接的列表,并在需要时遍历这个列表,使用lws_write函数向每个客户端发送数据。 你可以在LWS_CALLBACK_ESTABLISHED回调中添加客户端到列表中,在LWS_CALLBACK_CLOSED回调中从列表中移除客户端。 4. 使用lws_write函数向客户端发送数据 lws_write函数的原型如下: cpp ssize_t lws_w...
str, len );/* write out*/n =lws_write(wsi_in, out + LWS_SEND_BUFFER_PRE_PADDING, len, LWS_WRITE_TEXT);printf(KBLU"[websocket_write_back] %s\n"RESET, str);/* free the buffer*/free(out);return
01 头文件 C风格 #include<stdio.h> #include<math.h> C++风格 #include<iostream> #include<cs...
I have a frame deque , in other thread , frames are pushed into it one by one, once one frame is pushed into it , then call "lws_callback_on_writable" , and in "lws_callback_function" , can I use lws_write to send frames during iterating this frame deuqe with reason "LWS_CALL...