#!/bin/bash # Test script to verify VizionStreamer connection SOCKET="/tmp/vizion_control.sock" echo "=== VizionStreamer Connection Test ===" echo "" # Check if socket exists if [ ! -S "$SOCKET" ]; then echo "❌ FAIL: Socket not found at $SOCKET" echo "Please ensure VizionStreamer backend is running." exit 1 fi echo "✓ Socket found at $SOCKET" echo "" # Test get_status command echo "Testing get_status command..." RESPONSE=$(echo '{"command":"get_status"}' | socat - UNIX-CONNECT:$SOCKET 2>/dev/null) if [ $? -eq 0 ]; then echo "✓ Connection successful" echo "Response: $RESPONSE" echo "" else echo "❌ FAIL: Could not connect to socket" exit 1 fi # Test get_formats command echo "Testing get_formats command..." FORMATS=$(echo '{"command":"get_formats"}' | socat - UNIX-CONNECT:$SOCKET 2>/dev/null) if [ $? -eq 0 ]; then echo "✓ get_formats successful" # Pretty print if python3 is available if command -v python3 &> /dev/null; then echo "$FORMATS" | python3 -m json.tool 2>/dev/null || echo "$FORMATS" else echo "$FORMATS" fi echo "" else echo "❌ FAIL: Could not get formats" exit 1 fi echo "=== All tests passed! ===" echo "VizionStreamer backend is ready for use."