I'm wondering how can I send message to the particular websocket outside callback functions. I tried to do the following:
websck.h
Websock *wsk;
websck.c
void myWebsocketConnect(Websock *ws) {
ws->recvCb=myWebsocketRecv;
cgiWebsocketSend( ws, "Hi, Websocket!", 14, WEBSOCK_FLAG_NONE);
wsk = ws;
}
and in one of the tasks fuctioncs try to send message via cgiWebsocketSend:
#include "websck.h"
user_main(os_event_t *event) {
cgiWebsocketSend( wsk, buffer, os_strlen(buffer), WEBSOCK_FLAG_NONE);
}
Unfortunately cgiWebsocketSend always return 1 regardless how many bytes are in the buffer. Nothing happens, but spontaneous reset after a while