Registry / testing / botium-connector-websocket

botium-connector-websocket

JSON →
library0.0.12jsnpmunverified

A Botium connector for testing chatbots served via WebSocket endpoints. Version 0.0.12 is the latest stable release, with no recent updates. It transforms Botium's internal message format to match the WebSocket communication protocol, supporting both user-to-bot and bot-to-user directions. Compared to other Botium connectors (e.g., for REST or Socket.io), this one is specifically designed for raw WebSocket connections and requires manual configuration of request/response templates. It is part of the Botium ecosystem and works with Botium CLI, Bindings, and Box. Requires Node.js >=8.3 and peer dependency botium-core >=1.10.0.

npm install botium-connector-websocket
INSTALL
IMPORT
SIG · BOTIUM-CONNECTOR-W
B
botium-connector-websocket
testingjavascriptv0.0.12
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.

default
import BotiumConnectorWebsocket from 'botium-connector-websocket'
const botiumConnectorWebsocket = require('botium-connector-websocket').default
ESM default export. CommonJS require returns the constructor directly, not a module with default property.
BotiumConnectorWebsocket
const BotiumConnectorWebsocket = require('botium-connector-websocket')
const { BotiumConnectorWebsocket } = require('botium-connector-websocket')
CommonJS pattern: the module exports the class directly, not as a named export.
type Capabilities
import type { Capabilities } from 'botium-connector-websocket'
import { Capabilities } from 'botium-connector-websocket'
Capabilities is a TypeScript type, not a runtime value. Use type import to avoid bundling issues.
Caps
import { Caps } from 'botium-connector-websocket'
const { Caps } = require('botium-connector-websocket').default
Caps is a named export containing capability constants. In CommonJS, destructure from the module directly.

Shows how to use the WebSocket connector with Botium Core: set capabilities, start, send a message, and stop.

import BotiumConnectorWebsocket from 'botium-connector-websocket'; import { BotiumCore } from 'botium-core'; const caps = { CONTAINERMODE: 'websocket', WEBSOCKET_URL: process.env.WEBSOCKET_URL ?? 'ws://127.0.0.1:2345', WEBSOCKET_REQUEST_BODY_TEMPLATE: { conversationId: 'botium', text: '{{msg.messageText}}' }, WEBSOCKET_RESPONSE_TEXTS_JSONPATH: '$.text' }; async function runTest() { const core = new BotiumCore(caps); await core.Start(); const response = await core.UserSaysText('Hello'); console.log('Bot response:', response); await core.Stop(); } runTest().catch(console.error);
Debug
Known issues
gotchaThe WEBSOCKET_REQUEST_BODY_TEMPLATE and WEBSOCKET_RESPONSE_TEXTS_JSONPATH capabilities must be correctly configured, otherwise messages won't be sent or parsed.
fix
Ensure the template matches your bot's expected request format and the JSON path extracts the correct response text field.
affects: >=0.0.0
gotchaWhen using wss:// with self-signed certificates, TLS validation fails by default.
fix
Set WEBSOCKET_REJECT_UNAUTHORIZED to false in capabilities.
affects: >=0.0.0
deprecatedNode.js >=8.3 is required; older versions may not work.
fix
Upgrade Node.js to version 8.3 or higher.
affects: >=0.0.0
gotchaThe connector does not handle automatic reconnection; WebSocket disconnects will cause test failures.
fix
Implement custom logic or use a proxy that handles reconnection if needed.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'botium-core'
Missing peer dependency botium-core.
fix
Install botium-core: npm install botium-core
TypeError: BotiumConnectorWebsocket is not a constructor
Incorrect import: using default import in CommonJS, or named import in ESM.
fix
Use correct import pattern: const BotiumConnectorWebsocket = require('botium-connector-websocket'); for CommonJS, or import BotiumConnectorWebsocket from 'botium-connector-websocket'; for ESM.
Error: connect ECONNREFUSED 127.0.0.1:2345
WebSocket server is not running or unreachable.
fix
Start the WebSocket server on the specified URL/port, or update WEBSOCKET_URL capability.
Error: Invalid JSON path expression: $..
Malformed JSON path in WEBSOCKET_RESPONSE_TEXTS_JSONPATH.
fix
Use a valid JSONPath expression, e.g., '$.text' for a top-level text field.
Upgrade
Version history
0.0.12latest on npm
Audit
Dependencies
botium-corerequiredCore Botium library required for test execution
Agent activity
20 hits · last 30 days
node
17
Amazon
1
OpenAI (training)
1
Resources
botium-connector-websocket — npm install botium-connector-websocket · libregistry