I know the procedure in eclipse but in android studio it's difficult
This is the link of library
I know the procedure in eclipse but in android studio it's difficult
This is the link of library
 
    
    The README.md in the library says DEPRECATED big and fat and provides a link to a better solution: https://github.com/koush/AndroidAsync. If you use this library simply add this line to you gradle dependencies:
compile 'com.koushikdutta.async:androidasync:2.+'
 
    
    Use this library org.java_websocket
First thing you should import that library in build.gradle
repositories {
     mavenCentral()
}
then add the implementation in dependency{}
implementation "org.java-websocket:Java-WebSocket:1.3.0"
Then you can use this code
 private void ConnectToWebSocket() {
    URI uri;
    try {
        uri = new URI("ws://192.168.1.135:9000/");
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return;
    }
    mWebSocketClient = new WebSocketClient(uri) {
        @Override
        public void onOpen(ServerHandshake serverHandshake) {
            Log.i("Websocket", "Opened");
            mWebSocketClient.send("Hello from " + Build.MANUFACTURER + " " + Build.MODEL);
        }
        @Override
        public void onMessage(String s) {
            final String message = s;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    TextView textView = (TextView)findViewById(R.id.edittext_chatbox);
                    textView.setText(textView.getText() + "\n" + message);
                }
            });
        }
        @Override
        public void onClose(int i, String s, boolean b) {
            Log.i("Websocket", "Closed " + s);
        }
        @Override
        public void onError(Exception e) {
            Log.i("Websocket", "Error " + e.getMessage());
        }
    };
    mWebSocketClient.connect();
}
