#!/bin/bash

HELLO=/home/jobol/.local/lib/afb/hello3.so
valgrind afb-daemon -t '' --auto-api /tmp --no-ldpaths --binding $HELLO --ws-server unix:/tmp/toto?as-api=hello -p 1111 &
sleep 2

for ((i = 2222 ; i <= 9999 ; i += 1111)); do
	afb-daemon -t '' --auto-api /tmp --no-ldpaths --binding $HELLO -p $i &
done
sleep 1

for ((i = 2222 ; i <= 9999 ; i += 1111)); do
	afb-client-demo "ws://localhost:$i/api?token=4&uuid=1" toto ping true
done
sleep 1

for ((i = 2222 ; i <= 9999 ; i += 1111)); do
	afb-client-demo "ws://localhost:$i/api?token=4&uuid=1" hello exit 0
done
sleep 1

afb-client-demo 'ws://localhost:1111/api?token=4&uuid=1' hello exit 0
wait
