socket io

This commit is contained in:
CoGomu
2025-07-06 18:17:40 +02:00
parent 4ead1cc0b9
commit 36d5f98dc9
7 changed files with 129 additions and 10 deletions

View File

@@ -0,0 +1,18 @@
// Only runs on client-side
import { io } from 'socket.io-client';
export default defineNuxtPlugin(() => {
const socket = io('http://localhost:8080'); // Update with your backend URL
// Optional: handle connect
socket.on('connect', () => {
console.log('Connected with socket ID:', socket.id);
});
// Inject globally
return {
provide: {
socket,
},
};
});