{"id":48833,"library":"onedionys-websocket-wrapper","title":"One Dionys WebSocket Wrapper","description":"One Dionys WebSocket Wrapper v5.0.0 provides a lightweight abstraction over the native WebSocket API, offering simplified syntax for opening connections, sending messages, and handling events like open, message, error, and close. Released on 31 March 2024, it is part of the One Dionys ecosystem and includes ongoing updates. Key differentiators include an easy-to-use interface and a focus on browser environments, though it lacks built-in reconnection, heartbeat, or advanced state management found in alternatives like `ws` or `socket.io`.","status":"active","version":"5.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/onedionys/onedionys-websocket-wrapper","tags":["javascript","onedionys","tea","package-manager","websocket-wrapper"],"install":[{"cmd":"npm install onedionys-websocket-wrapper","lang":"bash","label":"npm"},{"cmd":"yarn add onedionys-websocket-wrapper","lang":"bash","label":"yarn"},{"cmd":"pnpm add onedionys-websocket-wrapper","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional peer dependency for Node.js environments if native WebSocket is unavailable.","package":"ws","optional":true}],"imports":[{"note":"This package uses CommonJS and does not provide ESM exports. Use require() to avoid import errors.","wrong":"import WebSocketWrapper from 'onedionys-websocket-wrapper';","symbol":"WebSocketWrapper","correct":"const WebSocketWrapper = require('onedionys-websocket-wrapper');"},{"note":"Do not confuse with the native WebSocket constructor; always use the library's wrapper.","wrong":"const socket = new WebSocket('ws://localhost:8080');","symbol":"WebSocketWrapper","correct":"const WS = require('onedionys-websocket-wrapper');\nconst socket = new WS('ws://localhost:8080');"},{"note":"The package exports a single class named WebSocketWrapper, not WebSocket.","wrong":"const { WebSocket } = require('onedionys-websocket-wrapper');","symbol":"WebSocketWrapper","correct":"const { WebSocketWrapper } = require('onedionys-websocket-wrapper');"}],"quickstart":{"code":"const WebSocketWrapper = require('onedionys-websocket-wrapper');\nconst socket = new WebSocketWrapper('wss://echo.websocket.org');\nsocket.on('open', () => {\n  console.log('Connected');\n  socket.send('Hello, world!');\n});\nsocket.on('message', (data) => {\n  console.log('Received:', data);\n  socket.close();\n});\nsocket.on('error', (err) => console.error('Error:', err));\nsocket.on('close', () => console.log('Disconnected'));","lang":"javascript","description":"Create a WebSocket connection using the wrapper, send a message, log received data, and handle events."},"warnings":[{"fix":"Use const WebSocketWrapper = require('onedionys-websocket-wrapper');","message":"The package currently does not support ESM imports. Use CommonJS require() to avoid syntax errors.","severity":"gotcha","affected_versions":"<=5.0.0"},{"fix":"Implement custom reconnection logic in the 'close' event handler.","message":"No built-in reconnection. Disconnections require manual re-instantiation.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Access underlying socket via internal property if needed, or test with your use case.","message":"The wrapper may not expose all native WebSocket properties (e.g., readyState, bufferedAmount). Check documentation.","severity":"gotcha","affected_versions":"<=5.0.0"}],"env_vars":null,"search_vec":"'2024':40 '31':38 'abstract':13 'advanc':77 'altern':82 'api':18 'browser':66 'built':72 'built-in':71 'close':35 'connect':24 'differenti':54 'dioni':2,6,47 'easi':58 'easy-to-us':57 'ecosystem':48 'environ':67 'error':33 'event':29 'focus':64 'found':80 'handl':28 'heartbeat':75 'includ':50,55 'interfac':61 'javascript':87 'key':53 'lack':70 'lightweight':12 'like':30,83 'manag':79,92 'march':39 'messag':26,32 'nativ':16 'offer':19 'one':1,5,46 'onedioni':88 'ongo':51 'open':23,31 'packag':91 'package-manag':90 'part':43 'provid':10 'reconnect':74 'releas':36 'send':25 'simplifi':20 'socket.io':86 'state':78 'syntax':21 'tea':89 'though':68 'updat':52 'use':60 'v5.0.0':9 'websocket':3,7,17,94 'websocket-wrapp':93 'wrapper':4,8,95 'ws':84","created_at":"2026-06-07T16:58:42.515565+00:00","updated_at":"2026-06-07T16:58:42.515565+00:00","problems":[{"fix":"Run 'npm install onedionys-websocket-wrapper' and verify package.json.","cause":"Package not installed or typo in npm install command.","error":"Error: Cannot find module 'onedionys-websocket-wrapper'"},{"fix":"Change to const WebSocketWrapper = require('onedionys-websocket-wrapper');","cause":"Incorrect import style (ESM import used for CommonJS module).","error":"TypeError: WebSocketWrapper is not a constructor"},{"fix":"Ensure WebSocket server is listening at the specified address. Use wss:// for secure connections if needed.","cause":"Server not running or wrong URL.","error":"WebSocket connection to 'ws://localhost:8080' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED"}],"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/onedionys/onedionys-websocket-wrapper#readme","github":"https://github.com/onedionys/onedionys-websocket-wrapper","docs":null,"changelog":null,"pypi":null,"npm":"onedionys-websocket-wrapper","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}}