Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,17 @@ $(LIB_WS): $(WS_OBJ)
$(Q)$(AR) $(ARFLAGS) $(LIB_WS) $^

# Examples
examples: examples/echo/echo examples/ping/ping
examples: examples/echo/echo examples/ping/ping examples/relay/relay
examples/echo/echo: examples/echo/echo.o $(LIB_WS)
@echo " LINK $@"
$(Q)$(CC) $(CFLAGS) $< -o $@ $(LDLIBS)
examples/ping/ping: examples/ping/ping.o $(LIB_WS)
@echo " LINK $@"
$(Q)$(CC) $(CFLAGS) $< -o $@ $(LDLIBS)
examples/relay/relay: examples/relay/relay.o examples/relay/waitlist.o examples/relay/peers_lut.o examples/relay/json_pars.o $(LIB_WS)
@echo " LINK $@"
$(Q)$(CC) $(CFLAGS) -pthread $^ -o $@ $(LDLIBS)


# Autobahn tests
tests: examples
Expand Down Expand Up @@ -194,5 +198,7 @@ clean:
@rm -f $(TOYWS)/toyws.o $(TOYWS)/tws_test.o $(TOYWS)toyws_test
@rm -f examples/echo/{echo,echo.o}
@rm -f examples/ping/{ping,ping.o}
@rm -f examples/relay/relay
@rm -f examples/relay/*.o
@$(MAKE) clean -C tests/
@$(MAKE) clean -C tests/fuzzy
4 changes: 4 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ to all connected clients.
- [vtouchpad](vtouchpad): A 'virtual touchpad' that remotely controls
a computer's mouse.

- [relay](relay): A simple relay server that connects peers on a one-to-one
basis and relays messages between them. UUIDs are used to authenticate peers.


If you have other examples and/or small demos that might be useful for
illustrating wsServer's functionality, feel free to submit a PR.

Expand Down
17 changes: 17 additions & 0 deletions examples/relay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (C) 2022 Davidson Francis <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>

add_executable(relay relay.c)
target_link_libraries(relay ws)
Loading