socket-devkit
v1.0.0
Published
Developer toolkit for Socket.IO - Event inspector, connection monitor, performance profiler, type-safe events, and event recorder
Maintainers
Readme
socket-devkit
Developer toolkit for Socket.IO - Debug, monitor, and optimize your real-time applications.
Installation
npm install socket-devkitQuick Start
import { Server } from 'socket.io';
import { devkit } from 'socket-devkit';
const io = new Server(httpServer);
// Attach devkit to your Socket.IO server
devkit.attach(io, {
inspector: true, // Pretty console logging of all events
monitor: true, // Connection tracking
profiler: true, // Performance metrics
recorder: true // Event recording for replay
});
// Your normal Socket.IO code
io.on('connection', (socket) => {
// devkit automatically logs all events
});Features
🔍 Event Inspector
Real-time logging of all Socket.IO events with color-coded output.
📊 Connection Monitor
Track connected clients, rooms, and namespaces.
⚡ Performance Profiler
Measure message latency, throughput, and memory usage.
🎬 Event Recorder
Record and replay events for debugging.
✅ Type-Safe Events
Define event schemas with runtime validation.
import { defineEvents } from 'socket-devkit';
const events = defineEvents({
'chat:message': { text: 'string', userId: 'string' },
'user:typing': { isTyping: 'boolean' }
});
// Validate incoming data
const result = events.validate('chat:message', data);
if (!result.valid) {
console.error(result.errors);
}API
devkit.attach(io, options)
Attach devkit to a Socket.IO server.
devkit.getStats()
Get current performance statistics.
devkit.getConnections()
Get list of all connected sockets.
devkit.getRecordedEvents()
Get all recorded events.
defineEvents(schema)
Define typed events with validation.
License
MIT © Harshit
