couchbase / couchbase-lite-java-listener

Embedded web server to expose Couchbase Lite REST API on an http socket
Apache License 2.0
12 stars 32 forks source link

Android : couchbase-lite-java-listener with XHR request wont work in background in latest chrome. #88

Open NitzDKoder opened 5 years ago

NitzDKoder commented 5 years ago

Hi Folks,

1)App design same as https://github.com/couchbase/couchbase-lite-java-listener/issues/78

2)Currently has below chrome issue/behavior and app JS /XHR client request fails to work in background. https://github.com/couchbaselabs/TodoLite-PhoneGap/blob/f1a810f9408a9807f3bf25ae69ba1d6a6aaee71c/js/modules.js https://bugs.chromium.org/p/chromium/issues/detail?id=913373.

3)JS/Webview Websockets client requests seems working, does the websocket TJWS was tested anytime with CBL?

http://tjws.sourceforge.net/ Acme.Serve.SelectorAcceptor - non secure, channel based implementation (use with websocket in non blocking IO mode). rogatkin.wskt.SSLSelectorAcceptor - secure, channel based implementation (use with websocket in non blocking IO mode).

4)@pasin please share your thoughts on how servlet 2.3 was picked? and which version of TJWS is used in CBL Listener?

5) Tried enabling websocket provider(https://github.com/couchbase/couchbase-lite-java-listener/blob/master/vendor/tjws/src/java/Acme/Serve/Serve.java#L708) which uses 3.1 servlet below error is seen.Looks to me Serve.java(servlet 2.3) and Websocket code(servlet 3.1).

Getting error in https://github.com/couchbase/couchbase-lite-java-listener/blob/master/vendor/tjws/src/java/Acme/Serve/Serve.java

error: ServeConnection is not abstract and does not override abstract method getHeaderNames() in HttpServletRequest

error: getHeaderNames() in ServeConnection cannot implement getHeaderNames() in HttpServletResponse return type Enumeration is not compatible with Collection
error: getHeaders(String) in ServeConnection cannot implement getHeaders(String) in HttpServletResponse return type Enumeration is not compatible with Collection

https://github.com/saces/servlet-api-2.5/blob/master/src/javax/servlet/http/HttpServletResponse.java https://github.com/saces/servlet-api-2.5/blob/master/src/javax/servlet/http/HttpServletRequest.java#L230
https://github.com/javaee/servlet-spec/blob/master/src/main/java/javax/servlet/http/HttpServletResponse.java#L416

Thanks Nithin

NitzDKoder commented 5 years ago

@pasin

Please clarify the below.

1)If the this module is changed from XHR to web-socket API's. https://github.com/couchbaselabs/TodoLite-PhoneGap/blob/f1a810f9408a9807f3bf25ae69ba1d6a6aaee71c/js/modules.js

2)Enable Websocket at TJWS server, then the do we need any other changes at listener or router for CBL REST requests to work? i.e message/header format for web-socket design will change?

https://github.com/couchbase/couchbase-lite-java-core/tree/master/src/main/java/com/couchbase/lite/router

https://github.com/couchbase/couchbase-lite-java-listener/tree/master/src/main/java/com/couchbase/lite/listener

Thanks Nithin

pasin commented 5 years ago

@NitzDKoder CBL Android 1.x doesn't support Web Socket. We have never tested or attempted to enable Web Socket with TJWS server. The TJWS version info and the source code is in here.

NitzDKoder commented 5 years ago

@pasin thanks..

Any design thoughts how easy to enable the TJWS with websocket? when enabled, what changes are expected at router side?