libwebsockets/minimal-examples-lowlevel/client-server/minimal-ws-proxy
2023-12-08 13:23:04 +00:00
..
mount-origin examples: move existing to m-e-lowlevel and start repoulating m-e with SS 2021-10-08 09:49:05 +01:00
CMakeLists.txt cmake: upgrade everyone to 3.5 minimum version 2023-12-08 13:23:04 +00:00
minimal-ws-proxy.c http: server: added no-cache handling to mounts 2021-12-13 19:02:56 +00:00
protocol_lws_minimal.c examples: move existing to m-e-lowlevel and start repoulating m-e with SS 2021-10-08 09:49:05 +01:00
README.md examples: move existing to m-e-lowlevel and start repoulating m-e with SS 2021-10-08 09:49:05 +01:00

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.