1
0
This commit is contained in:
Your Name 2023-07-08 17:12:37 +08:00
parent 7342f14f05
commit 15b483ba80

View File

@ -4,6 +4,7 @@ std::vector<struct lws*> websockets;
DDNetCQ* DDNetCQ::instance=nullptr;
DDNetCQ* const ddncq=DDNetCQ::GetInstance();
#define MAX_PLAYLOAD_LEN 10*1024
unsigned char msg[8196]="";
int WebSocketListener( struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len ) {
switch (reason){
case LWS_CALLBACK_ESTABLISHED:
@ -12,11 +13,9 @@ int WebSocketListener( struct lws *wsi, enum lws_callback_reasons reason, void *
break;
case LWS_CALLBACK_RECEIVE:
{
unsigned char* msg=new uint8_t[8192];
memset(msg,0,sizeof(msg));
memcpy(msg,in,len);
ddncq->gamectx->SendChat(-1,CGameContext::CHAT_ALL,(const char*)msg);
delete[] msg;
}
break;
case LWS_CALLBACK_CLOSED: