tiny_httpd/tests/test_ws.sh
2024-04-15 10:26:52 -04:00

19 lines
406 B
Bash
Executable file

#!/usr/bin/env sh
ECHO=$1
PORT=8096
PINGS=0 "$ECHO" -p $PORT >/dev/null 2>/dev/null &
PID=$!
sleep 0.1
trap "echo 'exit' && kill $PID" EXIT
( cd ws-client && cargo build -p tinyhttpd-ws-client && cp target/debug/tinyhttpd-ws-client .. ) || exit 1
echo "pwd: $PWD"
(cd ./"$(dirname $0)/ws-client/" &&
( (cat testfile; sleep 1) \
| ./tinyhttpd-ws-client tunnel "ws://localhost:${PORT}/echo" ))