{"id":49391,"library":"siokit-client","title":"siokit-client","description":"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.","status":"active","version":"0.1.5","language":"javascript","source_language":"en","source_url":"https://github.com/Nahida-aa/siokit","tags":["javascript","socket.io","client","websocket","real-time","browser","typescript"],"install":[{"cmd":"npm install siokit-client","lang":"bash","label":"npm"},{"cmd":"yarn add siokit-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add siokit-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides core event bus and types used by the client","package":"siokit-core","optional":false},{"reason":"Handles encoding/decoding of Socket.IO packets","package":"siokit-parser","optional":false}],"imports":[{"note":"The package is ESM-only (no CommonJS) and exports a named function newSocket. Using require will fail.","wrong":"const { newSocket } = require('siokit-client')","symbol":"newSocket","correct":"import { newSocket } from 'siokit-client'"},{"note":"Socket is only a TypeScript type, not a runtime value. Use 'import type' to avoid bundler errors.","wrong":"import { Socket } from 'siokit-client'","symbol":"Socket","correct":"import type { Socket } from 'siokit-client'"},{"note":"These are generic type parameters for typed events. They are only available as types.","wrong":"import { ClientEvents } from 'siokit-client'","symbol":"ClientEvents / ServerEvents","correct":"import type { ClientEvents, ServerEvents } from 'siokit-client'"}],"quickstart":{"code":"import { newSocket } from 'siokit-client'\n\nconst socket = newSocket('http://localhost:3000')\n\nsocket.on('connect', () => {\n  console.log('connected')\n  socket.emit('hello')\n})\n\nsocket.on('reply', (msg: string) => {\n  console.log(msg) // 'world'\n})\n\n// With acknowledgement\nconst result = await socket.emitWithAck('ping')\nconsole.log(result) // 'pong'\n\n// Binary\nsocket.emit('data', new Uint8Array([1,2,3]))\nsocket.on('binaryReply', (data: Uint8Array) => {\n  console.log('Received binary:', data)\n})","lang":"typescript","description":"Demonstrates connecting with newSocket, listening to connect, emitting/receiving typed events, using emitWithAck for acknowledgements, and sending/receiving binary data."},"warnings":[{"fix":"Lock the version in package.json and watch for breaking changes on GitHub.","message":"The package is at version 0.1.5 and the API may change without notice. Do not rely on stable exports.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use the official Socket.IO client if you need polling fallback.","message":"The package does not support HTTP long-polling; only WebSocket transport is implemented.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If using Node.js, use a WebSocket polyfill such as 'ws' with the 'websocket' transport.","message":"The client only works in environments with the WebSocket API (browsers, Bun). Node.js requires an extra polyfill or adapter.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use import type syntax for type-only exports.","message":"TypeScript users must import types with 'import type' to avoid bundler errors (e.g., import type { Socket } from 'siokit-client').","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.1.5':19 'acknowledg':29 'agnost':54 'binari':32 'browser':102 'bun':57 'cadenc':88 'client':3,6,10,65,68,97 'client-sid':9 'compat':13 'core':49 'depend':74 'develop':94 'earli':93 'ecosystem':40 'emiss':27 'emitwithack':30 'event':26 'hono':60 'javascript':95 'leverag':76 'librari':14 'lightweight':70 'listen':28 'modern':77 'month':86 'node.js':58 'offici':63 'packag':83 'parser':46 'part':36 'provid':21 'real':100 'real-tim':99 'releas':87 'runtim':53,73 'runtime-agnost':52 'server':43 'side':11 'siokit':2,5,39,42,45,48,67 'siokit-cli':1,4,66 'siokit-cor':47 'siokit-pars':44 'siokit-serv':41 'socket.io':12,64,96 'still':91 'strong':80 'support':33 'time':101 'transport':23 'type':25,81 'typescript':17,78,103 'unlik':61 'version':18 'websocket':22,98 'work':55 'written':15 'zero':72","created_at":"2026-06-07T17:01:31.714617+00:00","updated_at":"2026-06-07T17:01:31.714617+00:00","problems":[{"fix":"Use import { newSocket } from 'siokit-client' or enable ESM in your project (e.g., set \"type\": \"module\" in package.json).","cause":"The package is ESM-only, but you are using require() (CommonJS).","error":"ERR_REQUIRE_ESM: require() of ES Module not supported"},{"fix":"Ensure you call newSocket(url) and use the returned object.","cause":"The socket variable is not a Socket instance; likely forgot to call newSocket.","error":"TypeError: socket.emit is not a function"},{"fix":"Configure the server to use WebSocket only, or use the official Socket.IO client for fallback.","cause":"The library only implements WebSocket, not HTTP long-polling. The server might be trying to poll.","error":"Error: socket.io client only supports WebSocket transport"},{"fix":"Use import type { Socket } from 'siokit-client' instead.","cause":"Socket is a type, not a value. You cannot import it as a runtime symbol.","error":"Cannot find name 'Socket'. Did you mean 'newSocket'?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Nahida-aa/siokit#readme","github":"https://github.com/Nahida-aa/siokit","docs":null,"changelog":null,"pypi":null,"npm":"siokit-client","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}