public WebSocketCall createWebSocketCall ( String url , Map < String , String > headers ) { String base64Credentials = buildBase64Credentials ( ) ; Request . Builder requestBuilder = new Request . Builder ( ) . url ( url ) . addHeader ( "Authorization" , "Basic " + base64Credentials ) . addHeader ( "Accept" , "application/json" ) ; if ( headers != null ) { for ( Map . Entry < String , String > header : headers . entrySet ( ) ) { requestBuilder . addHeader ( header . getKey ( ) , header . getValue ( ) ) ; } } Request request = requestBuilder . build ( ) ; WebSocketCall wsc = WebSocketCall . create ( getHttpClient ( ) , request ) ; return wsc ; }
Creates a websocket that connects to the given URL .