Skip to content

Commit

Permalink
Rename Realtime to RealtimeClientV2
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Jan 4, 2024
1 parent f73cbc6 commit 4cd9b83
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Sources/Realtime/Channel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public actor RealtimeChannelV2 {
case unsubscribing
}

weak var socket: Realtime? {
weak var socket: RealtimeClientV2? {
didSet {
assert(oldValue == nil, "socket should not be modified once set")
}
Expand All @@ -44,7 +44,7 @@ public actor RealtimeChannelV2 {
init(
topic: String,
config: RealtimeChannelConfig,
socket: Realtime
socket: RealtimeClientV2
) {
_status = CurrentValueSubject(.unsubscribed)
status = _status.share().eraseToAnyPublisher()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Realtime/RealtimeClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct StateChangeCallbacks {
/// The `RealtimeClient` constructor takes the mount point of the socket,
/// the authentication params, as well as options that can be found in
/// the Socket docs, such as configuring the heartbeat.
@available(*, deprecated, message: "Use new Realtime class instead.")
@available(*, deprecated, message: "Use new RealtimeClientV2 class instead.")
public class RealtimeClient: PhoenixTransportDelegate {
// ----------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public protocol AuthTokenProvider: Sendable {
func authToken() async -> String?
}

public actor Realtime {
public actor RealtimeClientV2 {
public struct Configuration: Sendable {
var url: URL
var apiKey: String
Expand Down
4 changes: 2 additions & 2 deletions Sources/Supabase/SupabaseClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public final class SupabaseClient: @unchecked Sendable {
/// Realtime client for Supabase
public let realtime: RealtimeClient

public lazy var realtimeV2: Realtime = .init(
config: Realtime.Configuration(
public lazy var realtimeV2: RealtimeClientV2 = .init(
config: RealtimeClientV2.Configuration(
url: supabaseURL.appendingPathComponent("/realtime/v1"),
apiKey: supabaseKey,
authTokenProvider: self
Expand Down
8 changes: 4 additions & 4 deletions Tests/RealtimeTests/RealtimeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ final class RealtimeTests: XCTestCase {
func testConnect() async {
let mock = MockWebSocketClient(status: [.success(.open)])

let realtime = Realtime(
config: Realtime.Configuration(url: url, apiKey: apiKey, authTokenProvider: nil),
let realtime = RealtimeClientV2(
config: RealtimeClientV2.Configuration(url: url, apiKey: apiKey, authTokenProvider: nil),
makeWebSocketClient: { _ in mock }
)

Expand All @@ -33,8 +33,8 @@ final class RealtimeTests: XCTestCase {
func testChannelSubscription() async throws {
let mock = MockWebSocketClient(status: [.success(.open)])

let realtime = Realtime(
config: Realtime.Configuration(url: url, apiKey: apiKey, authTokenProvider: nil),
let realtime = RealtimeClientV2(
config: RealtimeClientV2.Configuration(url: url, apiKey: apiKey, authTokenProvider: nil),
makeWebSocketClient: { _ in mock }
)

Expand Down
2 changes: 1 addition & 1 deletion Tests/RealtimeTests/_PushTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import XCTest

final class _PushTests: XCTestCase {
let socket = Realtime(config: Realtime.Configuration(
let socket = RealtimeClientV2(config: RealtimeClientV2.Configuration(
url: URL(string: "https://localhost:54321/v1/realtime")!,
apiKey: "apikey",
authTokenProvider: nil
Expand Down

0 comments on commit 4cd9b83

Please sign in to comment.