Sync Android SDK  0.9.0
com.twilio.sync.StreamObserver Class Referenceabstract

Observer for all operations on a Stream. More...

Public Member Functions

 StreamObserver ()
 Keep default constructor, you don't need to override it. More...
 
void onOpened (Stream stream)
 This callback is invoked when Stream object has been initialised and opened locally. More...
 
void onRemoved (EventContext context)
 This callback is invoked when the Stream has been removed. More...
 
void onMessagePublished (EventContext context, Stream.Message message)
 This callback is invoked when Stream has successfully published a message. More...
 
void onErrorOccurred (ErrorInfo error)
 This callback is invoked when a Stream operation has encountered a error in local request. More...
 

Detailed Description

Observer for all operations on a Stream.

You should create your own subclass of StreamObserver and override functions you are interested in.

Observer will receive callbacks for all operations on a Stream. To distinguish parallel streams of local operations your application could use local flow identifier.

Callbacks in the observer will be called from a background thread. You will need to repost your work to UI thread if you do any UI-related operations in the callback.

Constructor & Destructor Documentation

com.twilio.sync.StreamObserver.StreamObserver ( )

Keep default constructor, you don't need to override it.

If you do override make sure to call the inherited constructor.

Member Function Documentation

void com.twilio.sync.StreamObserver.onErrorOccurred ( ErrorInfo  error)

This callback is invoked when a Stream operation has encountered a error in local request.

Parameters
errorError description.
void com.twilio.sync.StreamObserver.onMessagePublished ( EventContext  context,
Stream.Message  message 
)

This callback is invoked when Stream has successfully published a message.

Parameters
contextContext indicating if change was local or remote.
messageSnapshot of the received message.
void com.twilio.sync.StreamObserver.onOpened ( Stream  stream)

This callback is invoked when Stream object has been initialised and opened locally.

Parameters
streamStream object that has been opened. This parameter you should take and use as your initialised instance of a stream.
void com.twilio.sync.StreamObserver.onRemoved ( EventContext  context)

This callback is invoked when the Stream has been removed.

Parameters
contextContext indicating if change was local or remote.