mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
e8313084f9
This adds few functions to use evhttp-based webserver to handle incoming WebSockets connections. We've tried to use both libevent and libwebsockets in our application, but found that we need to have different ports at the same time to handle standard HTTP and WebSockets traffic. This change can help to stick only with libevent library. Implementation was inspired by modified Libevent source code in ipush project [1]. [1]: https://github.com/sqfasd/ipush/tree/master/deps/libevent-2.0.21-stable Also, WebSocket-based chat server was added as a sample.
12 lines
389 B
C
12 lines
389 B
C
#ifndef REGRESS_HTTP_H
|
|
#define REGRESS_HTTP_H
|
|
|
|
struct evhttp *http_setup(
|
|
ev_uint16_t *pport, struct event_base *base, int mask);
|
|
evutil_socket_t http_connect(const char *address, ev_uint16_t port);
|
|
struct bufferevent *create_bev(
|
|
struct event_base *base, evutil_socket_t fd, int ssl_mask, int flags_);
|
|
void http_writecb(struct bufferevent *bev, void *arg);
|
|
|
|
#endif /* REGRESS_HTTP_H */
|