package com.example.tolucagraphics import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.WebSocket import okhttp3.WebSocketListener import java.util.concurrent.TimeUnit object Socket { var username: String?= null var SERVER_PATH: String?= null private val client = OkHttpClient.Builder() .readTimeout(1, TimeUnit.SECONDS) .build() var request : Request?=null lateinit var listener : WebSocketListener fun realizarConex() { request = Request.Builder() .url(SERVER_PATH + username) .build() } var webSocketSingle : WebSocket?=null fun conectarconWS(){ webSocketSingle = client.newWebSocket(request!!, listener) } }