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.
|
CompletableFuture<ChannelClient> |
connectAsync() |
void |
create(AsyncCallback<ChannelProvider> callback)
Create a new channel.
|
protected void |
fireChannelConnectEvent(String channelId,
String uuid,
String name,
String channelName,
String endpointId) |
protected void |
fireChannelDisconnectEvent(String channelId,
String uuid,
String name,
String channelName,
String endpointId) |
DesktopConnection |
getDesktopConnection() |
String |
getName()
Get the name of the channel
|
boolean |
hasClient()
Check if the channel has client connected
|
boolean |
hasProvider()
Check if the channel has provider created
|
org.json.JSONObject |
invokeAction(EndpointIdentity targetIdentity,
String action,
org.json.JSONObject actionPayload,
org.json.JSONObject senderIdentity) |
void |
processConnection(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 CompletableFuture<ChannelClient> connectAsync()
public void connect(AsyncCallback<ChannelClient> callback)
callback - The callback that receives the wrapped ChannelClient objectpublic boolean hasProvider()
public boolean hasClient()
public org.json.JSONObject invokeAction(EndpointIdentity targetIdentity, 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, String endpointId)
protected void fireChannelDisconnectEvent(String channelId, String uuid, String name, String channelName, String endpointId)
public void processConnection(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 © 2021. All rights reserved.