public class Channel extends Object
| Constructor and Description |
|---|
Channel(String name,
DesktopConnection desktopConnection) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addChannelListener(ChannelListener listener) |
protected void |
addEventListener(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback)
Registers an event listener on the specified event
|
void |
addEventListener(String type,
EventListener listener,
AckListener callback)
Registers an event listener on the specified event
|
void |
connect(AsyncCallback<ChannelClient> callback)
Connect to the channel.
|
void |
connect(String nameAlias,
AsyncCallback<ChannelClient> callback)
Connect to the channel with an alias.
|
void |
create(AsyncCallback<ChannelProvider> callback)
Create a new channel.
|
protected void |
fireChannelConnectEvent(String channelId,
String uuid,
String name,
String channelName) |
protected void |
fireChannelDisconnectEvent(String channelId,
String uuid,
String name,
String channelName) |
DesktopConnection |
getDesktopConnection() |
String |
getName()
Get the name of the channel
|
boolean |
hasClient(String channelId)
Check if the channel has client connected
|
boolean |
hasProvider(String channelId)
Check if the channel has provider created
|
boolean |
hasRegisteredAction(String channelId,
String action) |
org.json.JSONObject |
invokeAction(String channelId,
String action,
org.json.JSONObject actionPayload,
org.json.JSONObject senderIdentity) |
void |
processConnection(String channelId,
org.json.JSONObject payload) |
boolean |
removeChannelListener(ChannelListener listener) |
void |
removeEventListener(String type,
EventListener listener,
AckListener callback)
Removes a previously registered event listener from the specified event
|
public Channel(String name, DesktopConnection desktopConnection)
public String getName()
public DesktopConnection getDesktopConnection()
public void create(AsyncCallback<ChannelProvider> callback)
callback - The callback that receives the wrapped ChannelProvider objectpublic void connect(AsyncCallback<ChannelClient> callback)
callback - The callback that receives the wrapped ChannelClient objectpublic void connect(String nameAlias, AsyncCallback<ChannelClient> callback)
nameAlias - callback - public boolean hasProvider(String channelId)
channelId - id of the channelpublic boolean hasClient(String channelId)
channelId - id of the channelpublic org.json.JSONObject invokeAction(String channelId, String action, org.json.JSONObject actionPayload, org.json.JSONObject senderIdentity)
public boolean addChannelListener(ChannelListener listener)
public boolean removeChannelListener(ChannelListener listener)
protected void fireChannelConnectEvent(String channelId, String uuid, String name, String channelName)
protected void fireChannelDisconnectEvent(String channelId, String uuid, String name, String channelName)
public void processConnection(String channelId, org.json.JSONObject payload)
protected void addEventListener(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback)
throws DesktopException
Supported system event types are:
subscriptionObject - A JSON object containing subscription information such as the topic and typelistener - EventListener for the eventcallback - AckListener for the requestDesktopException - if this method fails to add event listener specifiedEventListener,
AckListenerpublic void addEventListener(String type, EventListener listener, AckListener callback) throws DesktopException
Supported system event types are:
type - Type of the eventlistener - EventListener for the eventcallback - AckListener for the requestDesktopException - if this method fails to add event listener specifiedEventListener,
AckListenerpublic void removeEventListener(String type, EventListener listener, AckListener callback) throws DesktopException
type - Type of the eventlistener - EventListener for the eventcallback - AckListener for the requestDesktopException - if this method fails to remove event listener specifiedDesktopException,
EventListener,
AckListenerCopyright © 2020. All rights reserved.