You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/09/14 03:52:49 UTC

[GitHub] pablichjenkov opened a new issue #2581: Android and IOS client support

pablichjenkov opened a new issue #2581: Android and IOS client support
URL: https://github.com/apache/incubator-pulsar/issues/2581
 
 
   I am trying to build a Chat App with the purpose of testing Apache Pulsar. I am facing the following problems on both mobile platforms.
   Android:
   I was trying to run the java client on Android having no success at doing so. Pure Java compilation phase passes, however, at some point later the Android build process transform all .class files to .dex files, to run on the Android VM(ART). During this process I had some errors complaining about some classes either being duplicated or corrupted. On top of that we still have the risk that the a Classloader failed to resolve certain JAR dependency class at run time.
   IOS:
   No Client at all.
   
   Given above unsuitability I decided to create my own  REST clients. I am able to run Pulsar server application on my local environment and send/receive messages using the pulsar-client program. However, I have not been able to connect to the server from Android.
   The [official documentation](https://pulsar.incubator.apache.org/docs/latest/clients/WebSocket/#Producerendpoint-r2hxu) says that in order to send a message, a client should create a WebSocket connection to the broker endpoint and send a json formatted text with a key named **payload**. 
   Following that I should be able to connect to the Producer endpoint with bellow code unless I am missing something.:
   
   *Bellow code uses OkHttpClient library*
   `
   String wsUrl = "ws://192.168.1.123:6650/ws/v2/producer/persistent/public/default/my-topic";
   webSocket = okHttpClient.newWebSocket(wsRequest, wsListener);
   `
   
   As soon as the connection is started the websocket listener invoke the Failure callback method.
   Below message is shown in the logs by the okHttpClient:
   
   `
   D/OkHttp: <-- HTTP FAILED: java.io.IOException: unexpected end of stream on Connection{192.168.1.123:6650, proxy=DIRECT hostAddress=/192.168.1.123:6650 cipherSuite=none protocol=http/1.1}
   `
   
   Check code here [sample source code:](https://github.com/pablichjenkov/Pulsar-Droid/blob/master/app/src/main/java/com/ncl/pulsarj/MainActivity.java)
   
   **I am running a local standalone instance in a MAC Book Pro and Firewall is OFF.**
   
   Thanks in advance
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services