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.
|
CompletionStage<ChannelClient> |
connectAsync()
Connect to a channel provider
|
CompletionStage<ChannelClient> |
connectAsync(Boolean noWait,
Object connectPayload)
Connect to a channel provider with a payload passed to the provider
|
CompletionStage<ChannelClient> |
connectAsync(Object connectPayload)
Connect to a channel provider with a payload passed to the provider
|
void |
create(AsyncCallback<ChannelProvider> callback)
Create a new channel.
|
CompletionStage<ChannelProvider> |
createAsync() |
protected void |
fireChannelConnectEvent(ConnectionEvent event) |
protected void |
fireChannelDisconnectEvent(ConnectionEvent event) |
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
|
Object |
invokeAction(EndpointIdentity targetIdentity,
String action,
Object 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 CompletionStage<ChannelProvider> createAsync()
public void create(AsyncCallback<ChannelProvider> callback)
callback
- The callback that receives the wrapped ChannelProvider
objectpublic CompletionStage<ChannelClient> connectAsync()
public CompletionStage<ChannelClient> connectAsync(Object connectPayload)
connectPayload
- connection payloadpublic CompletionStage<ChannelClient> connectAsync(Boolean noWait, Object connectPayload)
noWait
- if true, the request will fail if the provider is not runningconnectPayload
- connection payloadpublic void connect(AsyncCallback<ChannelClient> callback)
callback
- The callback that receives the wrapped ChannelClient
objectpublic boolean hasProvider()
public boolean hasClient()
public Object invokeAction(EndpointIdentity targetIdentity, String action, Object actionPayload, org.json.JSONObject senderIdentity)
public boolean addChannelListener(ChannelListener listener)
public boolean removeChannelListener(ChannelListener listener)
protected void fireChannelConnectEvent(ConnectionEvent event)
protected void fireChannelDisconnectEvent(ConnectionEvent event)
public void processConnection(org.json.JSONObject payload) throws Exception
Exception
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
,
AckListener
public 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
,
AckListener
public 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
,
AckListener
Copyright © 2022. All rights reserved.