feat/reverb (#20)
Co-authored-by: jon brookes <marshyon@gmail.com> Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/20
This commit is contained in:
parent
74bc17d019
commit
21147af908
30 changed files with 1948 additions and 29 deletions
50
resources/views/test-reverb.blade.php
Normal file
50
resources/views/test-reverb.blade.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Reverb Test</title>
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Reverb Connection Test</h1>
|
||||
<div id="status">Waiting for Echo...</div>
|
||||
<div id="messages"></div>
|
||||
|
||||
<script>
|
||||
const status = document.getElementById('status');
|
||||
const messages = document.getElementById('messages');
|
||||
|
||||
// Wait for Echo to be ready
|
||||
function checkEcho() {
|
||||
console.log('Checking Echo:', window.Echo);
|
||||
|
||||
if (window.Echo && window.Echo !== null) {
|
||||
status.textContent = 'Echo ready, connecting...';
|
||||
status.style.color = 'blue';
|
||||
|
||||
try {
|
||||
window.Echo.channel('test-channel')
|
||||
.listen('test.message', (e) => {
|
||||
console.log('Received message:', e);
|
||||
messages.innerHTML += `<p>Received: ${e.message}</p>`;
|
||||
});
|
||||
|
||||
status.textContent = 'Connected to Reverb!';
|
||||
status.style.color = 'green';
|
||||
} catch (error) {
|
||||
status.textContent = `Connection failed: ${error.message}`;
|
||||
status.style.color = 'red';
|
||||
console.error('Echo error:', error);
|
||||
}
|
||||
} else {
|
||||
setTimeout(checkEcho, 100); // Check again in 100ms
|
||||
}
|
||||
}
|
||||
|
||||
// Start checking after DOM loads
|
||||
document.addEventListener('DOMContentLoaded', checkEcho);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue