public abstract class

DataStream

extends Object
java.lang.Object
   ↳ org.ocast.core.DataStream
Known Direct Subclasses

Class Overview

Used for custom messaging. It allows an application to send and receive customized messages to/from the web application.

Summary

Public Constructors
DataStream(String serviceName)
Create a Datastream for the given service name
Public Methods
String getServiceName()
Get the service name this DataStream is used for.
abstract void onMessage(JSONObject message)
Subclass must implement this method to manage incoming messages
void sendMessage(JSONObject message, Consumer<JSONObject> onSuccess, Consumer<Throwable> onFailure)
Send a message on the DataStream
void setBrowser(Browser browser)
Attach the stream to the provided Browser
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DataStream (String serviceName)

Create a Datastream for the given service name

Parameters
serviceName the service name

Public Methods

public String getServiceName ()

Get the service name this DataStream is used for.

Returns
  • the service name if this DataStream

public abstract void onMessage (JSONObject message)

Subclass must implement this method to manage incoming messages

Parameters
message the incoming message

public void sendMessage (JSONObject message, Consumer<JSONObject> onSuccess, Consumer<Throwable> onFailure)

Send a message on the DataStream

Parameters
message the message to be sent
onSuccess to be called on success
onFailure to be called if an error occured

public void setBrowser (Browser browser)

Attach the stream to the provided Browser

Parameters
browser the