Skip to content

Commit 18b99ec

Browse files
Nick Ficanonficano
authored andcommitted
docs: clarify websocket auth flow
1 parent 7630850 commit 18b99ec

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

docs/getting-started.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ app.Run("http://localhost:7878")
140140

141141
On the client side use `WebSocketClientTransport.connectAsync`, which
142142
opens a `ClientWebSocket`, attaches the bearer token (if any) as an
143-
`Authorization` header on the upgrade, and returns an `ITransport`:
143+
`Authorization` header on the upgrade, and returns an `ITransport`.
144+
That header is host-layer metadata; ARCP session authentication still
145+
comes from `ArcpClientOptions.Auth`:
144146

145147
```fsharp
146148
open ARCP.Client.Transport
@@ -152,7 +154,10 @@ task {
152154
(Some "demo") // bearer token, or None
153155
CancellationToken.None
154156
155-
let client = new ArcpClient(transport, ArcpClientOptions.defaults)
157+
let client =
158+
new ArcpClient(
159+
transport,
160+
{ ArcpClientOptions.defaults with Auth = AuthScheme.Bearer "demo" })
156161
let! _session = client.ConnectAsync CancellationToken.None
157162
return client
158163
}

docs/transports.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ the paired `Receive` enumerator on the other side.
2525
`WebSocketClientTransport` wraps a `System.Net.WebSockets.WebSocket`.
2626
The convenience constructor `connectAsync` opens a `ClientWebSocket`,
2727
adds the bearer token (if any) as the `Authorization` header on the
28-
upgrade, and returns an `ITransport`:
28+
upgrade, and returns an `ITransport`. Treat that header as host-layer
29+
metadata; ARCP session authentication still comes from
30+
`ArcpClientOptions.Auth`:
2931

3032
```fsharp
3133
open ARCP.Client.Transport

src/Arcp.Client/Transport/WebSocket.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ type WebSocketClientTransport(socket: WebSocket, ownsSocket: bool) =
143143
module WebSocketClientTransport =
144144
/// Connect a new client transport to `uri`. The bearer token (if
145145
/// provided) is added as the `Authorization` header on the
146-
/// upgrade request — the runtime adapter authenticates against
147-
/// the parsed `IPrincipal` rather than re-reading the header.
146+
/// upgrade request. That header is host-layer metadata; ARCP
147+
/// session authentication is configured separately on
148+
/// `ArcpClientOptions`.
148149
let connectAsync (uri: Uri) (bearerToken: string option) (ct: CancellationToken) : Task<ITransport> =
149150
task {
150151
let client = new ClientWebSocket()

0 commit comments

Comments
 (0)