okhttp / okhttp3 / WebSocket / Factory / newWebSocket

newWebSocket

abstract fun newWebSocket(request:Request, listener:WebSocketListener):WebSocket

Creates a new web socket and immediately returns it. Creating a web socket initiates an asynchronous process to connect the socket. Once that succeeds or fails, listener will be notified. The caller must either close or cancel the returned web socket when it is no longer in use.