Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dreamsxin/websocketclient

a websocket client by C language
https://github.com/dreamsxin/websocketclient

Last synced: 2 months ago
JSON representation

a websocket client by C language

Awesome Lists containing this project

README

        

websocketClient
===============

a websocket client by C language

##Usage

```c
#include
#include
#include "websocket.h"

int main()
{
char *str = "hello websocket\n";
wsContext_t *ctx = NULL;
ctx = wsContextNew(NULL);
wsCreateConnection(ctx,"ws://10.0.0.150:1238/");
sendUtf8Data(ctx,str,strlen(str));
while(1)
{
int len = recvData(ctx,buff, 1*1024*1024);
if(len)
{
fprintf(stderr,"recv ok %d\n",len);
}

if(len < 0)
{
break;
}
}
wsContextFree(ctx);
return 0;
}
```