Package com.openfin.desktop.channel
Class ChannelProvider
- java.lang.Object
-
- com.openfin.desktop.channel.ChannelBase
-
- com.openfin.desktop.channel.ChannelProvider
-
public class ChannelProvider extends ChannelBase
-
-
Field Summary
-
Fields inherited from class com.openfin.desktop.channel.ChannelBase
afterAction, beforeAction, channelActionMap, defaultAction, endpointIdentity, onError
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaddProviderListener(ChannelProviderListener listener)Add a listener for channel provider eventsprotected voidcleanup()voiddestroy(AckListener ackListener)Destroy the channelvoiddispatch(org.json.JSONObject destinationIdentity, java.lang.String action, org.json.JSONObject actionPayload, AckListener ackListener)Dispatch an action to a specified client.java.util.concurrent.CompletableFuture<Ack>dispatchAsync(org.json.JSONObject destinationIdentity, java.lang.String action, org.json.JSONObject actionPayload)Dispatch an action to a specified client.protected voidfireClientConnectEvent(ChannelClientConnectEvent event)protected voidfireClientDisconnectEvent(ChannelClientConnectEvent event)voidprocessConnection(org.json.JSONObject connectionPayload, org.json.JSONObject ackToSenderPayload)voidpublish(java.lang.String action, org.json.JSONObject actionPayload, AckListener ackListener)Deprecated.Use publishAsyncjava.util.List<java.util.concurrent.CompletableFuture<Ack>>publishAsync(java.lang.String action, org.json.JSONObject actionPayload)Publish an action and payload to every connected client.booleanregister(java.lang.String action, ChannelAction listener)Register an action to be called by ChannelClientbooleanremoveProviderListener(ChannelProviderListener listener)Add a ChannelProviderListener-
Methods inherited from class com.openfin.desktop.channel.ChannelBase
dispatch, dispatchAsync, getChannelId, getChannelName, getEndpointId, getEndpointIdentity, getName, getUuid, hasRegisteredAction, remove, setAfterAction, setBeforeAction, setDefaultAction, setOnError
-
-
-
-
Method Detail
-
destroy
public void destroy(AckListener ackListener)
Destroy the channel- Parameters:
ackListener- AckListener for the request
-
processConnection
public void processConnection(org.json.JSONObject connectionPayload, org.json.JSONObject ackToSenderPayload) throws java.lang.Exception- Throws:
java.lang.Exception
-
publish
public void publish(java.lang.String action, org.json.JSONObject actionPayload, AckListener ackListener)Deprecated.Use publishAsyncPublish an action and payload to every connected client.- Parameters:
action- Name of the action to be invoked by the channel clientactionPayload- Payload to be sent along with the action.ackListener- AckListener for the request
-
publishAsync
public java.util.List<java.util.concurrent.CompletableFuture<Ack>> publishAsync(java.lang.String action, org.json.JSONObject actionPayload)
Publish an action and payload to every connected client.- Parameters:
action- Name of the action to be invoked by the channel clientactionPayload- Payload to be sent along with the action.- Returns:
- A list of CompletableFuture with Ack object
- See Also:
Ack
-
dispatchAsync
public java.util.concurrent.CompletableFuture<Ack> dispatchAsync(org.json.JSONObject destinationIdentity, java.lang.String action, org.json.JSONObject actionPayload)
Dispatch an action to a specified client.- Parameters:
destinationIdentity- Identity of the target client.action- Name of the action to be invoked by the client.actionPayload- Payload to be sent along with the action.- Returns:
- CompletableFuture with Ack object
- See Also:
Ack
-
dispatch
public void dispatch(org.json.JSONObject destinationIdentity, java.lang.String action, org.json.JSONObject actionPayload, AckListener ackListener)Dispatch an action to a specified client.- Parameters:
destinationIdentity- Identity of the target client.action- Name of the action to be invoked by the client.actionPayload- Payload to be sent along with the action.ackListener- AckListener for the request
-
register
public boolean register(java.lang.String action, ChannelAction listener)Register an action to be called by ChannelClient- Overrides:
registerin classChannelBase- Parameters:
action- Name of the action to be invoked by the channel clientlistener- Function representing the action to be taken on a client dispatch.- Returns:
- if the action was registered successfully
-
cleanup
protected void cleanup()
- Overrides:
cleanupin classChannelBase
-
addProviderListener
public boolean addProviderListener(ChannelProviderListener listener)
Add a listener for channel provider events- Parameters:
listener- listener to add- Returns:
-
removeProviderListener
public boolean removeProviderListener(ChannelProviderListener listener)
Add a ChannelProviderListener- Parameters:
listener- listener to remove- Returns:
-
fireClientConnectEvent
protected void fireClientConnectEvent(ChannelClientConnectEvent event) throws java.lang.Exception
- Throws:
java.lang.Exception
-
fireClientDisconnectEvent
protected void fireClientDisconnectEvent(ChannelClientConnectEvent event)
-
-