Skip to content

Commit 2ce5554

Browse files
committed
Update README.md
1 parent 689f5c5 commit 2ce5554

1 file changed

Lines changed: 53 additions & 7 deletions

File tree

README.md

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,59 @@
1-
# Lucee Websocket Client Extension
1+
# Lucee WebSocket Client Extension
22

3-
Provides Websocket Client Support for Lucee
3+
[![Java CI](https://github.com/lucee/extension-websocket-client/actions/workflows/main.yml/badge.svg)](https://github.com/lucee/extension-websocket-client/actions/workflows/main.yml)
44

5-
Docs: https://docs.lucee.org/reference/functions/createwebsocketclient.html
5+
WebSocket *client* support for Lucee CFML — connect to any WebSocket server from CFML and handle messages via listener components. Powered by [nv-websocket-client](https://github.com/TakahikoKawasaki/nv-websocket-client).
66

7-
Downloads: https://download.lucee.org/#058215B3-5544-4392-A187A1649EB5CA90
7+
**Requires Lucee 6.2+** (supports both Lucee 6.x and 7.x / Jakarta).
88

9-
Issues: [https://luceeserver.atlassian.net/issues/?jql=labels%20%3D%20%22websockets%22](https://luceeserver.atlassian.net/issues/?jql=labels%20%3D%20%22websockets%22)
9+
## Installation
1010

11-
## Websocket Extension
11+
Install via Lucee Admin, or pin in your environment:
1212

13-
https://github.com/lucee/extension-websocket
13+
```bash
14+
LUCEE_EXTENSIONS=org.lucee:websocket-client-extension:2.3.0.9-SNAPSHOT
15+
```
16+
17+
## Documentation
18+
19+
- **Docs**: [docs.lucee.org/reference/functions/createwebsocketclient.html](https://docs.lucee.org/reference/functions/createwebsocketclient.html)
20+
- **Downloads**: [download.lucee.org](https://download.lucee.org/#058215B3-5544-4392-A187A1649EB5CA90)
21+
- **Issues**: [Lucee JIRA — WebSocket Issues](https://luceeserver.atlassian.net/issues/?jql=labels%20%3D%20%22websockets%22)
22+
23+
### What's Included
24+
25+
- **`CreateWebSocketClient( endpoint, component )` BIF** — connects to a WebSocket server and returns a client socket you can `sendText()` / `sendBinary()` / `disconnect()` on.
26+
- **Listener callbacks** — your component receives `onMessage`, `onBinaryMessage`, `onClose`, `onError`, `onPing`, `onPong`.
27+
- **Per-message deflate**`permessage-deflate` extension enabled by default.
28+
29+
## Quick Example
30+
31+
```cfml
32+
// Listener component
33+
component {
34+
35+
function onMessage( message ) {
36+
systemOutput( "received: " & message, true );
37+
}
38+
39+
function onError( type, cause ) {
40+
systemOutput( "error [#type#]: #cause.getMessage()#", true );
41+
}
42+
43+
function onClose() {
44+
systemOutput( "connection closed", true );
45+
}
46+
47+
}
48+
```
49+
50+
```cfml
51+
ws = CreateWebSocketClient( "ws://localhost:8080/ws/EchoListener", new Listener() );
52+
ws.sendText( "hello server" );
53+
// ...
54+
ws.disconnect();
55+
```
56+
57+
## Related
58+
59+
- **[extension-websocket](https://github.com/lucee/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.

0 commit comments

Comments
 (0)