You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//: You'll need to make sure you import the ApolloSQLite library IF you are not using CocoaPods (CocoaPods will automatically flatten everything down to a single Apollo import):
14
10
import ApolloSQLite
15
11
@@ -26,12 +22,16 @@ let sqliteCache = try SQLiteNormalizedCache(fileURL: sqliteFileURL)
26
22
//: And then instantiate an instance of `ApolloStore` with the cache you've just created:
27
23
letstore=ApolloStore(cache: sqliteCache)
28
24
25
+
//: Next, you'll need to set up a network transport, since you will also need that to set up the client:
Copy file name to clipboardExpand all lines: Playgrounds/ApolloMacPlayground.playground/Pages/Subscriptions.xcplaygroundpage/Contents.swift
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -17,15 +17,15 @@ Your web backend must declare support for subscriptions in the Schema just like
17
17
18
18
To use subscriptions, you need to have a `NetworkTransport` implementation which supports them. Fortunately, with the `ApolloWebSocket` package, there are two!
19
19
20
-
The first is the `WebSocketTransport`, which works with the web socket, and the second is the `SplitNetworkTransport`, which uses a web socket for subscriptions but a normal `HTTPNetworkTransport` for everything else.
20
+
The first is the `WebSocketTransport`, which works with the web socket, and the second is the `SplitNetworkTransport`, which uses a web socket for subscriptions but a normal `RequestChainNetworkTransport` for everything else.
21
21
22
22
In this instance, we'll use a `SplitNetworkTransport` since we want to demonstrate subscribing to changes, but we need to also be able to send changes for that subscription to come through.
23
23
*/
24
24
25
-
//:First, setup the `HTTPNetworkTransport`:
25
+
//:First, setup the `RequestChainNetworkTransport` that will handle your HTTP requests:
//: Next, set up the `WebSocketTransport` to talk to the websocket endpoint. Note that this may take a different URL, sometimes with a `ws` prefix, than your normal http endpoint:
31
31
@@ -34,7 +34,7 @@ let webSocketTransport = WebSocketTransport(request: URLRequest(url: webSocketUR
34
34
35
35
//: Then, set up the split transport with the two transports you've just created:
// MARK: - Default implementation for typescript codegen
@@ -25,10 +39,10 @@ open class LegacyInterceptorProvider: InterceptorProvider {
25
39
/// - Parameters:
26
40
/// - client: The `URLSessionClient` to use. Defaults to the default setup.
27
41
/// - shouldInvalidateClientOnDeinit: If the passed-in client should be invalidated when this interceptor provider is deinitialized. If you are recreating the `URLSessionClient` every time you create a new provider, you should do this to prevent memory leaks. Defaults to true, since by default we provide a `URLSessionClient` to new instances.
28
-
/// - store: The `ApolloStore` to use when reading from or writing to the cache.
42
+
/// - store: The `ApolloStore` to use when reading from or writing to the cache. Defaults to the default initializer for ApolloStore.
0 commit comments