Skip to content

Commit

Permalink
Moved okHttpClient to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamGrzybkowski committed Oct 22, 2018
1 parent 18de293 commit cc6e3ad
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/kotlin/org/phoenixframework/PhxSocket.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const val DEFAULT_HEARTBEAT: Long = 30000

open class PhxSocket(
url: String,
params: Payload? = null
params: Payload? = null,
private val client: OkHttpClient = OkHttpClient.Builder().build()
) : WebSocketListener() {

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -99,7 +100,6 @@ open class PhxSocket(
.create()

private val request: Request
private val client: OkHttpClient

/// WebSocket connection to the server
private var connection: WebSocket? = null
Expand Down Expand Up @@ -133,7 +133,6 @@ open class PhxSocket(

// Create the request and client that will be used to connect to the WebSocket
request = Request.Builder().url(httpUrl).build()
client = OkHttpClient.Builder().build()
}


Expand Down

0 comments on commit cc6e3ad

Please sign in to comment.