Skip to content

AtaoistPriest/ws_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ws_server

This is a web socket server implemented with C.
You can quickly start the server by specifying IP, Port, and message processing functions.
The project also has built-in lightweight logger.

example

#include <unistd.h>
#include <pthread.h>
#include "./src/wbsocket_server.h"

long msg_switch(unsigned char *req, long req_len, unsigned char *res, long res_len)
{
	bzero(res, res_len);
	long len = sprintf((char *)res, "Recv %s Successfully", req);
	return len;
}

void test_ws_server()
{
	logger_init("./log");

	start_server("172.17.83.59", "52323", msg_switch);

	logger_destroy();
}

int main(void)
{
	test_ws_server();
	return 0;
}

About

This is a web socket server implemented with C.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published