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
Copy file name to clipboardExpand all lines: libraries/apollo-runtime/src/jvmCommonMain/kotlin/com/apollographql/apollo/network/websocket/WebSocketEngine.jvm.kt
Copy file name to clipboardExpand all lines: libraries/apollo-runtime/src/jvmCommonMain/kotlin/com/apollographql/apollo/network/ws/OkHttpWebSocketEngine.kt
+15-2Lines changed: 15 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,23 @@ import okhttp3.WebSocket
13
13
importokhttp3.WebSocketListener
14
14
importokio.ByteString
15
15
16
+
/**
17
+
* Creates a new [DefaultWebSocketEngine] from [webSocketFactory]
18
+
*
19
+
* This constructor accepts a function so that OkHttp is initialized from a background thread
20
+
*/
16
21
actualclassDefaultWebSocketEngine(
17
-
privatevalwebSocketFactory:WebSocket.Factory,
22
+
webSocketFactory: () ->WebSocket.Factory,
18
23
) : WebSocketEngine {
19
-
24
+
privateval webSocketFactory by lazy { webSocketFactory() }
25
+
26
+
/**
27
+
* Creates a new [DefaultWebSocketEngine] from [webSocketFactory]
28
+
*
29
+
* Prefer using the factory function accepting a function so that OkHttp is initialized from a background thread.
0 commit comments