Files
dayplanner/web/plugins/socket.client.ts
2025-07-06 18:17:40 +02:00

18 lines
388 B
TypeScript

// 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,
},
};
});