Skip to content

Commit 6fde879

Browse files
author
Guilherme Souza
committed
allow to nullify access token
1 parent 3bf4425 commit 6fde879

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
@@ -193,15 +193,15 @@ public final class RealtimeChannelV2: Sendable {
193193
)
194194
}
195195

196-
public func updateAuth(jwt: String) async {
196+
public func updateAuth(jwt: String?) async {
197197
logger?.debug("Updating auth token for channel \(topic)")
198198
await push(
199199
RealtimeMessageV2(
200200
joinRef: mutableState.joinRef,
201201
ref: socket.makeRef().description,
202202
topic: topic,
203203
event: ChannelEvent.accessToken,
204-
payload: ["access_token": .string(jwt)]
204+
payload: ["access_token": jwt.map { .string($0) } ?? .null]
205205
)
206206
)
207207
}

Sources/Realtime/V2/RealtimeClientV2.swift

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

349349
for channel in channels.values {
350-
if let token, channel.status == .subscribed {
350+
if channel.status == .subscribed {
351351
await channel.updateAuth(jwt: token)
352352
}
353353
}

0 commit comments

Comments
 (0)