#!/bin/bash # Simplified Ephemeral Event Test # Tests that ephemeral events are broadcast to active subscriptions echo "=== Generating Ephemeral Event (kind 20000) ===" event=$(nak event --kind 20000 --content "test ephemeral event") echo "$event" echo "" echo "=== Testing Ephemeral Event Broadcast ===" subscription='["REQ","test_sub",{"kinds":[20000],"limit":10}]' echo "Subscription Filter:" echo "$subscription" echo "" event_msg='["EVENT",'"$event"']' echo "Event Message:" echo "$event_msg" echo "" echo "=== Relay Responses ===" ( # Send subscription printf "%s\n" "$subscription" # Wait for subscription to establish sleep 1 # Send ephemeral event on same connection printf "%s\n" "$event_msg" # Wait for responses sleep 2 ) | timeout 5 websocat ws://127.0.0.1:8888 echo "" echo "Test complete!"