# Android-DDP **Repository Path**: mirrors_RocketChat/Android-DDP ## Basic Information - **Project Name**: Android-DDP - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-25 - **Last Updated**: 2026-02-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Android-DDP Promise-styled Android DDP implementation with Bolts-Android/RxJava. ## gradle integration (testing...) in build.gradle ``` allprojects { repositories { jcenter() maven { url 'https://github.com/RocketChat/Android-DDP/raw/master/repository' } // for Android-DDP } } ``` in app/build.gradle ``` dependencies { compile 'chat.rocket:android-ddp:0.0.8' } ``` ## Usage Example ``` ... OkHttpClient wsClient = new OkHttpClient().setReadTimeout(0, TimeUnit.NANOSECONDS); DDPClient ddpClient = new DDPClient(wsClient); // connect to ddp server. ddpClient.connect("wss://demo.rocket.chat/websocket").onSuccessTask(task -> { DDPClientCallback.Connect result = task.getResult(); // observe all callback events. result.client.getSubscriptionCallback().subscribe(event -> { Log.d(TAG,"Callback [DEBUG] < "+ event); }); // observe all callback events. result.client.getFailureObservable().subscribe(event -> { Log.w(TAG,"disconnected!"); }); // next try to login with token return result.client.rpc("login", new JSONArray().put(token) ,"2", 4000); }).onSuccess(task -> { DDPClientCallback.Connect result = task.getResult(); Log.d(TAG, "Login succeeded."); }).continueWith(task -> { if(task.isFaulted()){ if (task.getError instanceof DDPClientCallback.Connect.Error) { Log.e(TAG, "failed to connect.", task.getError()); } if (task.getError instanceof DDPClientCallback.RPC.Error) { Log.e(TAG, "failed to login.", task.getError()); } } return null; }); } ```