Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ The WebSocketClient is built on top of structured concurrency. When you connect

```swift
import WSClient
import Logging

let ws = WebSocketClient.connect(url: "ws://mywebsocket.com/ws") { inbound, outbound, context in
let logger = Logger(label: "My Project")

let ws = try await WebSocketClient.connect(url: "ws://mywebsocket.com/ws", logger: logger) { inbound, outbound, context in
try await outbound.write(.text("Hello"))
// you can convert the inbound stream of frames into a stream of full messages using `messages(maxSize:)`
for try await frame in inbound.messages(maxSize: 1 << 14) {
context.logger.info(frame)
context.logger.info("\(frame.description)")
}
}
```