booking/ttt_data.php

33 lines
874 B
PHP
Executable File

<!DOCTYPE html>
<html>
<head>
<title>WebSocket Example</title>
</head>
<body>
<div id="data-container"></div>
<script>
const ws = new WebSocket('wss://localhost:8083'); // Change the WebSocket URL and port as needed
ws.onopen = () => {
console.log('Connected to the WebSocket server');
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
// Handle incoming data and update the UI
const dataContainer = document.getElementById('data-container');
dataContainer.innerHTML = `Received data: ${JSON.stringify(data)}`;
};
ws.onerror = (error) => {
console.error('WebSocket error:', error);
};
ws.onclose = () => {
console.log('WebSocket connection closed');
};
</script>
</body>
</html>