mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
![]() Move the common plugin scanning dir stuff to be based on lws_dir, which already builds for windows. Previously this was done via dirent for unix and libuv for windows. Reduce the dl plat stuff to just wrap instantiation and destruction of dynlibs, establish common code in lib/misc/dir.c for plugin scanning itself. Migrate the libuv windows dl stuff to windows-plugins.c, so that he's available even if later libuv loop support becomes and event lib plugin. Remove the existing api exports scheme for plugins, just export a const struct now which has a fixed header type but then whatever you want afterwards depending on the class / purpose of the plugin. Place a "class" string in the header so there can be different kinds of plugins implying different types exported. Make the plugin apis public and add support for filter by class string, and per instantation / destruction callbacks so the subclassed header type can do its thing for the plugin class. The user provides a linked-list base for his class of plugins, so he can manage them completely separately and in user code / user export types. Rip out some last hangers-on from generic sessions / tables. This is all aimed at making the plugins support general enough so it can provide event lib plugins later. |
||
---|---|---|
.. | ||
mount-origin | ||
CMakeLists.txt | ||
minimal-ws-proxy.c | ||
protocol_lws_minimal.c | ||
README.md |
lws minimal ws proxy
Build
$ cmake . && make
Description
This is the same as minimal-ws-server-ring, but with the inclusion of a ws client connection to https://libwebsockets.org using the dumb-increment protocol feeding the ringbuffer.
Each client that connect to this server receives the content that had arrived on the client connection feeding the ringbuffer proxied to their browser window over a ws connection.
Usage
$ ./lws-minimal-ws-proxy
[2018/03/14 17:50:10:6938] USER: LWS minimal ws proxy | visit http://localhost:7681
[2018/03/14 17:50:10:6955] NOTICE: Creating Vhost 'default' port 7681, 2 protocols, IPv6 off
[2018/03/14 17:50:10:6955] NOTICE: Using non-SSL mode
[2018/03/14 17:50:10:7035] NOTICE: created client ssl context for default
[2018/03/14 17:50:11:7047] NOTICE: binding to lws-minimal-proxy
[2018/03/14 17:50:11:7047] NOTICE: lws_client_connect_2: 0x872e60: address libwebsockets.org
[2018/03/14 17:50:12:3282] NOTICE: lws_client_connect_2: 0x872e60: address libwebsockets.org
[2018/03/14 17:50:13:8195] USER: callback_minimal: established
Visit http://localhost:7681 on multiple browser windows
Data received on the remote wss connection is copied to all open browser windows.
A ringbuffer holds up to 8 lines of text in the server, and the browser shows the last 20 lines of received text.