Skip to content

Commit 3e2c4d7

Browse files
author
Guilherme Souza
committed
allow to nullify access token
1 parent 0830c5e commit 3e2c4d7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/Realtime/V2/RealtimeChannelV2.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ public final class RealtimeChannelV2: Sendable {
198198
)
199199
}
200200

201-
public func updateAuth(jwt: String) async {
201+
public func updateAuth(jwt: String?) async {
202202
logger?.debug("Updating auth token for channel \(topic)")
203203
await push(
204204
RealtimeMessageV2(
205205
joinRef: mutableState.joinRef,
206206
ref: socket.makeRef().description,
207207
topic: topic,
208208
event: ChannelEvent.accessToken,
209-
payload: ["access_token": .string(jwt)]
209+
payload: ["access_token": jwt.map { .string($0) } ?? .null]
210210
)
211211
)
212212
}

Sources/Realtime/V2/RealtimeClientV2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ public final class RealtimeClientV2: Sendable {
399399
}
400400

401401
for channel in subscriptions.values {
402-
if let token, channel.status == .subscribed {
402+
if channel.status == .subscribed {
403403
await channel.updateAuth(jwt: token)
404404
}
405405
}

0 commit comments

Comments
 (0)