Registry / messaging / siokit-client

siokit-client

JSON →
library0.1.5jsnpmunverified

siokit-client is the client-side Socket.IO compatible library written in TypeScript, version 0.1.5. It provides WebSocket transport with typed event emission, listening, acknowledgements (emitWithAck), and binary support. It is part of the siokit ecosystem (siokit-server, siokit-parser, siokit-core) and is runtime-agnostic, working with Bun, Node.js, and Hono. Unlike the official Socket.IO client, siokit-client is lightweight with zero runtime dependencies, and leverages modern TypeScript for strong typing. The package has a monthly release cadence and is still in early development.

npm install siokit-client
INSTALL
IMPORT
SIG · SIOKIT-CLIENT
S
siokit-client
messagingjavascriptv0.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

newSocket
import { newSocket } from 'siokit-client'
const { newSocket } = require('siokit-client')
The package is ESM-only (no CommonJS) and exports a named function newSocket. Using require will fail.
Socket
import type { Socket } from 'siokit-client'
import { Socket } from 'siokit-client'
Socket is only a TypeScript type, not a runtime value. Use 'import type' to avoid bundler errors.
ClientEvents / ServerEvents
import type { ClientEvents, ServerEvents } from 'siokit-client'
import { ClientEvents } from 'siokit-client'
These are generic type parameters for typed events. They are only available as types.

Demonstrates connecting with newSocket, listening to connect, emitting/receiving typed events, using emitWithAck for acknowledgements, and sending/receiving binary data.

import { newSocket } from 'siokit-client' const socket = newSocket('http://localhost:3000') socket.on('connect', () => { console.log('connected') socket.emit('hello') }) socket.on('reply', (msg: string) => { console.log(msg) // 'world' }) // With acknowledgement const result = await socket.emitWithAck('ping') console.log(result) // 'pong' // Binary socket.emit('data', new Uint8Array([1,2,3])) socket.on('binaryReply', (data: Uint8Array) => { console.log('Received binary:', data) })
Debug
Known issues
breakingThe package is at version 0.1.5 and the API may change without notice. Do not rely on stable exports.
fix
Lock the version in package.json and watch for breaking changes on GitHub.
affects: <1.0.0
gotchaThe package does not support HTTP long-polling; only WebSocket transport is implemented.
fix
Use the official Socket.IO client if you need polling fallback.
affects: >=0.0.0
gotchaThe client only works in environments with the WebSocket API (browsers, Bun). Node.js requires an extra polyfill or adapter.
fix
If using Node.js, use a WebSocket polyfill such as 'ws' with the 'websocket' transport.
affects: >=0.0.0
gotchaTypeScript users must import types with 'import type' to avoid bundler errors (e.g., import type { Socket } from 'siokit-client').
fix
Use import type syntax for type-only exports.
affects: >=0.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module not supported
The package is ESM-only, but you are using require() (CommonJS).
fix
Use import { newSocket } from 'siokit-client' or enable ESM in your project (e.g., set "type": "module" in package.json).
TypeError: socket.emit is not a function
The socket variable is not a Socket instance; likely forgot to call newSocket.
fix
Ensure you call newSocket(url) and use the returned object.
Error: socket.io client only supports WebSocket transport
The library only implements WebSocket, not HTTP long-polling. The server might be trying to poll.
fix
Configure the server to use WebSocket only, or use the official Socket.IO client for fallback.
Cannot find name 'Socket'. Did you mean 'newSocket'?
Socket is a type, not a value. You cannot import it as a runtime symbol.
fix
Use import type { Socket } from 'siokit-client' instead.
Upgrade
Version history
0.1.5latest on npm
Audit
Dependencies
siokit-corerequiredProvides core event bus and types used by the client
siokit-parserrequiredHandles encoding/decoding of Socket.IO packets
Agent activity
24 hits · last 30 days
node
20
Amazon
2
Bingbot
1
OpenAI (training)
1
Resources
siokit-client — npm install siokit-client · libregistry