WebSocket client support for Lucee CFML — connect to any WebSocket server from CFML and handle messages via listener components. Powered by nv-websocket-client.
Requires Lucee 6.2+ (supports both Lucee 6.x and 7.x / Jakarta).
Install via Lucee Admin, or pin in your environment:
LUCEE_EXTENSIONS=org.lucee:websocket-client-extension:2.3.0.9-SNAPSHOT- Docs: docs.lucee.org/reference/functions/createwebsocketclient.html
- Downloads: download.lucee.org
- Issues: Lucee JIRA — WebSocket Issues
CreateWebSocketClient( endpoint, component )BIF — connects to a WebSocket server and returns a client socket you cansendText()/sendBinary()/disconnect()on.- Listener callbacks — your component receives
onMessage,onBinaryMessage,onClose,onError,onPing,onPong. - Per-message deflate —
permessage-deflateextension enabled by default.
// Listener component
component {
function onMessage( message ) {
systemOutput( "received: " & message, true );
}
function onError( type, cause ) {
systemOutput( "error [#type#]: #cause.getMessage()#", true );
}
function onClose() {
systemOutput( "connection closed", true );
}
}ws = CreateWebSocketClient( "ws://localhost:8080/ws/EchoListener", new Listener() );
ws.sendText( "hello server" );
// ...
ws.disconnect();- extension-websocket — the server-side companion for hosting WebSocket endpoints in Lucee. Its integration tests exercise the full client⇄server loop (connect, send, echo, disconnect) and provide the real coverage for
sendText()/disconnect()in this extension.