Code Monkey home page Code Monkey logo

javawebsocketclient's People

Contributors

jacek-marchwicki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javawebsocketclient's Issues

how to tie subscription with Application Lifecycle

Thanks for this awesome Rx support. I need help in understanding how do I implement WebSockets so that it only lives for the Application Lifecycle.

I create a subscription in onCreate() of Application and unsubscribe in onDestroy()
Should I manage this subscription from an IntentService or if you have any other suggestions please let me know.

I also thought about implementing Sockets through GCMNetworkManager and manage subscription in this GCM task, but not sure if it's feasible or fit's my use case.

Please can you guide me in a correct direction

RxJava 2

When RxJava 2 support will be implemented?

NetworkOnMainThreadException when unsubscribing

Seeing some crash reports from users with stacktrace below. Odd because I thought this issue was fixed awhile back with OkHttp. Might be due to the fact that OkHttp-ws is still experimental.

This problem can be solved by setting unsubcribeOn() to a background thread for meantime.

Fatal Exception: java.lang.RuntimeException: Unable to pause activity: android.os.NetworkOnMainThreadException
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4379)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4338)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4313)
       at android.app.ActivityThread.access$1200(ActivityThread.java:197)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6872)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by android.os.NetworkOnMainThreadException
       at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147)
       at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:855)
       at okio.Okio$1.write(Okio.java:80)
       at okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
       at okio.RealBufferedSink.emit(RealBufferedSink.java:183)
       at okhttp3.internal.ws.WebSocketWriter.writeControlFrameSynchronized(WebSocketWriter.java:152)
       at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:111)
       at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:168)
       at com.appunite.websocket.rx.RxWebSockets$LockingWebSocket.close(RxWebSockets.java:209)
       at com.appunite.websocket.rx.RxWebSockets$1$2.call(RxWebSockets.java:163)
       at rx.subscriptions.BooleanSubscription.unsubscribe(BooleanSubscription.java:71)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at rx.subscriptions.SerialSubscription.unsubscribe(SerialSubscription.java:66)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
       at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
       at rx.Subscriber.unsubscribe(Subscriber.java:98)
       at com.domain.interactor.UseCase.unsubscribe(UseCase.java:36)
       at com.ui.playback.PlaybackPresenter.onPause(PlaybackPresenter.java:61)
       at com.ui.templates.BaseFragmentListener.onPause(BaseFragmentListener.java:80)
       at android.support.v4.app.Fragment.performPause(Fragment.java:2139)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1117)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
       at android.support.v4.app.FragmentManagerImpl.dispatchPause(FragmentManager.java:2060)
       at android.support.v4.app.FragmentController.dispatchPause(FragmentController.java:207)
       at android.support.v4.app.FragmentActivity.onPause(FragmentActivity.java:443)
       at com.ui.templates.BaseActivity.onPause(BaseActivity.java:47)
       at android.app.Activity.performPause(Activity.java:6706)
       at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1324)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4365)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4338)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4313)
       at android.app.ActivityThread.access$1200(ActivityThread.java:197)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6872)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.