Skip to content

Commit 029ee0d

Browse files
committed
Use close instead on connect
1 parent 01f18f2 commit 029ee0d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

FirebaseAI/Sources/Types/Internal/Live/LiveSessionService.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ actor LiveSessionService {
114114
/// Seperated into its own function to make it easier to surface a way to call it seperately when
115115
/// resuming the same session.
116116
func connect() {
117-
setupTask.cancel()
117+
close()
118118
// we launch the setup task in a seperate task to avoid blocking the parent context
119119
setupTask = Task { [weak self] in
120120
// we need a continuation to surface that the setup is complete, while still allowing us to listen to the server
@@ -148,11 +148,6 @@ actor LiveSessionService {
148148
///
149149
/// Will also close out the old websocket and the previous long running tasks.
150150
private func listenToServer(_ setupComplete: CheckedContinuation<Void, any Error>) async {
151-
// close out the existing connections, if any
152-
webSocket?.disconnect()
153-
responsesTask?.cancel()
154-
messageQueueTask?.cancel()
155-
156151
do {
157152
webSocket = try await createWebsocket()
158153
} catch {

0 commit comments

Comments
 (0)