@socketscope/adapters
v0.1.1
Published
Protocol adapters for SocketScope — socket.io classifier and other WebSocket protocols.
Downloads
254
Maintainers
Readme
@socketscope/adapters
Protocol-specific frame classifiers for SocketScope.
Currently ships:
- socket.io — recognizes engine.io ping/pong (
2/3) and Socket.IO packet types (CONNECT / DISCONNECT / EVENT / ACK / CONNECT_ERROR / BINARY_*) inside the4xenvelope. Extracts event name + payload from42["evt", data]frames.
Install
pnpm add @socketscope/adapters @socketscope/coreUsage
@socketscope/core ships a built-in classifier that already understands socket.io envelopes — you only need this package if you want to use the classifier outside of the interceptor (e.g. for a server-side decoder).
import { classifySocketIo, isSocketIoEnvelope } from '@socketscope/adapters';
const frame = '42["chat:message", {"text":"hi"}]';
if (isSocketIoEnvelope(frame)) {
const { type, label, severity, payload } = classifySocketIo(frame, 'in');
// { type: 'chat:message', payload: { text: 'hi' }, severity: 'in', ... }
}Coming next
sockette— passthrough adapter- SSE / EventSource bridge
- WebTransport bridge
PRs welcome — see CONTRIBUTING.md on the main repo.
License
MIT
