@@ -48,6 +48,8 @@ import kotlinx.coroutines.launch
4848import kotlinx.coroutines.runBlocking
4949import kotlinx.coroutines.withTimeout
5050import okhttp3.RequestBody
51+ import okhttp3.WebSocket
52+ import okhttp3.WebSocketListener
5153import okio.Source
5254import okio.source
5355import java.io.InputStream
@@ -332,33 +334,17 @@ class ContainerApi(dockerClientConfig: DockerClientConfig = defaultClientConfig,
332334 */
333335 @Throws(UnsupportedOperationException ::class , ClientException ::class , ServerException ::class )
334336 fun containerAttachWebsocket (
335- id : String ,
336- detachKeys : String? ,
337- logs : Boolean? ,
338- stream : Boolean? ,
339- stdin : Boolean? ,
340- stdout : Boolean? ,
341- stderr : Boolean?
342- ) {
337+ id : String , detachKeys : String? ,
338+ logs : Boolean? , stream : Boolean? , stdin : Boolean? , stdout : Boolean? , stderr : Boolean? ,
339+ wsListener : WebSocketListener
340+ ): WebSocket {
343341 val localVariableConfig = containerAttachWebsocketRequestConfig(id = id, detachKeys = detachKeys, logs = logs, stream = stream, stdin = stdin, stdout = stdout, stderr = stderr)
344342
345- val localVarResponse = request<Any ?>(
346- localVariableConfig
343+ val localVarResponse = requestWebSocket(
344+ localVariableConfig,
345+ wsListener
347346 )
348-
349- return when (localVarResponse.responseType) {
350- ResponseType .Success -> Unit
351- ResponseType .Informational -> throw UnsupportedOperationException (" Client does not support Informational responses." )
352- ResponseType .Redirection -> throw UnsupportedOperationException (" Client does not support Redirection responses." )
353- ResponseType .ClientError -> {
354- val localVarError = localVarResponse as ClientError <* >
355- throw ClientException (" Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} " , localVarError.statusCode, localVarResponse)
356- }
357- ResponseType .ServerError -> {
358- val localVarError = localVarResponse as ServerError <* >
359- throw ServerException (" Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} " , localVarError.statusCode, localVarResponse)
360- }
361- }
347+ return localVarResponse
362348 }
363349
364350 /* *
0 commit comments