How to resolve Connection error in couchdb android?

时间秒杀一切 提交于 2021-02-08 09:14:58

问题


Getting below error while connecting CouchDB server using Replicator

Status{activityLevel=CONNECTING,
       progress=Progress{completed=0, total=0},
       error=CouchbaseLiteException{CouchbaseLite,11001,'WebSocket connection closed by peer'}}

Status{activityLevel=STOPPED,
       progress=Progress{completed=0, total=0},
       error=CouchbaseLiteException{CouchbaseLite,11001,'WebSocket connection closed by peer'}}

Below is my code;

  Replicator replicator = null;

    try {
        CouchbaseLite.init(context);
        Database.setLogLevel(LogDomain.ALL, LogLevel.ERROR);
        DatabaseConfiguration databaseConfiguration = new DatabaseConfiguration();
        Database database = new Database("company-3", databaseConfiguration);

        URLEndpoint target = new URLEndpoint(new URI("ws://*****/company-3/"));

        ReplicatorConfiguration config = new ReplicatorConfiguration(database, target);
        config.setAuthenticator(new BasicAuthenticator("username", "password"));

        replicator = new Replicator(config);
        replicator.start();


    } catch (CouchbaseLiteException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }

Dependancy:

 implementation 'com.couchbase.lite:couchbase-lite-android:2.7.0'

来源:https://stackoverflow.com/questions/59945185/how-to-resolve-connection-error-in-couchdb-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!