# Socket.io Real-time Collaboration - FikoYT

## 👥 Multi-user Features

**3D Collaboration:**
- **Model sync:** Değişiklikleri paylaş
- **Cursor sharing:** Diğer kullanıcıları gör
- **Selection sync:** Ortak seçim
- **View sync:** Kamera paylaşımı

## 🔄 Sync Pattern

```typescript
// Değişiklik yap
model.position.set(10, 5, 0);

// Broadcast et
socket.emit("model:update", {
  id: model.id,
  position: model.position.toArray()
});

// Dinle ve uygula
socket.on("model:updated", (data) => {
  model.position.fromArray(data.position);
  render();
});
```

## 🎯 Collaboration Events

**Model Events:**
- `model:create` - Yeni model
- `model:update` - Güncelleme
- `model:delete` - Silme
- `model:transform` - Transform

**User Events:**
- `user:cursor` - İmleç pozisyonu
- `user:select` - Seçim
- `user:view` - Kamera view
- `user:join` - Proje katılımı

## 🏠 Room-based Collaboration

```typescript
// Proje odası
const projectId = "proj-123";

// Katıl
socket.emit("project:join", projectId);

// Broadcast sadece odaya
io.to(projectId).emit("model:update", data);

// Proje kullanıcıları
const users = io.sockets.adapter.rooms.get(projectId);
```

## ⚠️ Conflict Resolution

- **Last write wins** - Son yazan kazanır
- **Timestamp** - Zaman damgası kontrolü
- **User priority** - Kullanıcı önceliği
- **Lock mechanism** - Kilit sistemi

---
2025-11-06