socket-io
Real-time communication with Socket.IO including connection management, events, rooms, and error handling. Use when working on TitanMirror or any real-time…
от Sir-chawakorn★ 32 звезды на GitHub
Установить socket-io в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
🔌 Socket.IO Skill
Server Setup (Node.js)
const { Server } = require('socket.io');
const io = new Server(server, {
cors: { origin: '*' },
pingTimeout: 60000,
pingInterval: 25000
});
io.on('connection', (socket) => {
console.log('Client connected:', socket.id);
socket.on('disconnect', (reason) => {
console.log('Disconnected:', reason);
});
});
Client Setup
JavaScript
const socket = io('http://localhost:3000');
socket.on('connect', () => {
console.log('Connected!', socket.id);
});
socket.on('connect_error', (err) => {
console.error('Connection error:', err.message);
});
Android (Kotlin)
val options = IO.Options().apply {
reconnection = true
reconnectionAttempts = 5
reconnectionDelay = 1000
}
val socket = IO.socket("http://192.168.1.x:3000", options)
socket.connect()
Event Patterns
Emit & Listen
// Client → Server
socket.emit('frame', { data: base64Image });
// Server → Client
io.emit('command', { type: 'click', x: 100, y: 200 });
// Server → Specific client
io.to(socketId).emit('private', { message: 'hello' });
Acknowledgement
// Client
socket.emit('upload', file, (response) => {
console.log('Server confirmed:', response);
});
// Server
socket.on('upload', (file, callback) => {
saveFile(file);
callback({ success: true });
});
Rooms
// Join room
socket.join('device-' + deviceId);
// Send to room
io.to('device-' + deviceId).emit('frame', frameData);
// Leave room
socket.leave('device-' + deviceId);
Binary Data (TitanMirror)
// Server receives frame
socket.on('frame', (data) => {
// data is Buffer or ArrayBuffer
const buffer = Buffer.from(data);
broadcastFrame(buffer);
});
// Client sends frame (Android)
val bytes = compressToJPEG(bitmap)
socket.emit("frame", bytes)
Error Handling
socket.on('connect_error', (error) => {
if (error.message === 'xhr poll error') {
// Network issue - will auto-retry
}
});
socket.on('disconnect', (reason) => {
if (reason === 'io server disconnect') {
socket.connect(); // Manual reconnect
}
});
Performance Tips
| Tip | Why |
|---|---|
| Use binary instead of base64 | 33% smaller |
| Compress images (JPEG 50%) | Reduce bandwidth |
| Debounce frequent events | Prevent flooding |
| Use rooms for targeting | Avoid broadcast all |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл socket-io?
Real-time communication with Socket.IO including connection management, events, rooms, and error handling. Use when working on TitanMirror or any real-time applications.
Как установить скилл socket-io?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл socket-io запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…