T
- Supported types are String
, Byte
, Short
, Integer
, Long
,
Float
, Double
, Boolean
, Parcelable
,
or any class annotated with @Parcelpublic class RemoteEventController<T>
extends java.lang.Object
rx.Observable
at the client side.
To send a event, use sendEvent(Object)
Use sendCompleted()
to inform the client rx.Observable
that
the data stream is complete
Constructor and Description |
---|
RemoteEventController()
Create a default instance of
RemoteEventController
Use sendEvent(Object) , sendCompleted() to send the data |
RemoteEventController(<any> observable)
Creates an instance of
RemoteEventController with the given Observable |
Modifier and Type | Method and Description |
---|---|
RemoteEventManager |
getRemoteEventManager() |
void |
onClosed()
Override this to know when the client closed the remote observable.
|
void |
onSubscribed()
Override this to know when first client subscribed to the observable
|
void |
onUnSubscribed()
Override this to know when ALL clients have unsubscribed.
|
void |
sendCompleted()
Generate an onCompleted event at the client observable.
|
void |
sendError(java.lang.Exception exception)
Generate an onError event at the client observable.
|
void |
sendEvent(T data)
Send the given data to the client observable
|
void |
setDebug(boolean enable)
Enable or disable debug prints.
|
void |
setIgnoreIfDuplicateOfLast(boolean ignoreIfDuplicateOfLast)
If set, the
sendEvent(Object) wont be delivered if it is same as last event. |
void |
setRemoteObservableListener(RemoteObservableListener remoteObservableListener) |
public RemoteEventController()
RemoteEventController
Use sendEvent(Object)
, sendCompleted()
to send the datapublic RemoteEventController(<any> observable)
RemoteEventController
with the given Observable
observable
- The Observable
to listen topublic RemoteEventManager getRemoteEventManager()
public void setRemoteObservableListener(RemoteObservableListener remoteObservableListener)
public final void sendEvent(T data)
data
- The data that needs to be sendpublic final void sendCompleted()
public final void sendError(java.lang.Exception exception)
public void onSubscribed()
public void onUnSubscribed()
public void onClosed()
public void setDebug(boolean enable)
public void setIgnoreIfDuplicateOfLast(boolean ignoreIfDuplicateOfLast)
sendEvent(Object)
wont be delivered if it is same as last event.
Default false