Class Channel


  • public class Channel
    extends Object
    The Channel object allows an OpenFin application to create a channel as a ChannelProvider, or connect to a channel as a ChannelClient.
    Author:
    Anthony
    • Method Detail

      • getName

        public String getName()
        Get the name of the channel
        Returns:
        name of the channel
      • connectAsync

        public CompletionStage<ChannelClient> connectAsync()
        Connect to a channel provider
        Returns:
        A new CompletionStage for the client client
      • connectAsync

        public CompletionStage<ChannelClient> connectAsync​(Object connectPayload)
        Connect to a channel provider with a payload passed to the provider
        Parameters:
        connectPayload - connection payload
        Returns:
        A new CompletionStage for the channel client
      • connectAsync

        public CompletionStage<ChannelClient> connectAsync​(Boolean noWait,
                                                           Object connectPayload)
        Connect to a channel provider with a payload passed to the provider
        Parameters:
        noWait - if true, the request will fail if the provider is not running
        connectPayload - connection payload
        Returns:
        A new CompletionStage for the client client
      • hasProvider

        public boolean hasProvider()
        Check if the channel has provider created
        Returns:
        if the channel provider exists.
      • hasClient

        public boolean hasClient()
        Check if the channel has client connected
        Returns:
        true if a channel client exists
      • addChannelListener

        public boolean addChannelListener​(ChannelListener listener)
      • removeChannelListener

        public boolean removeChannelListener​(ChannelListener listener)
      • fireChannelConnectEvent

        protected void fireChannelConnectEvent​(ConnectionEvent event)
      • fireChannelDisconnectEvent

        protected void fireChannelDisconnectEvent​(ConnectionEvent event)
      • processConnection

        public void processConnection​(org.json.JSONObject payload)
                               throws Exception
        Throws:
        Exception
      • addEventListener

        protected void addEventListener​(org.json.JSONObject subscriptionObject,
                                        EventListener listener,
                                        AckListener callback)
                                 throws DesktopException
        Registers an event listener on the specified event
             Supported system event types are:
         
        Parameters:
        subscriptionObject - A JSON object containing subscription information such as the topic and type
        listener - EventListener for the event
        callback - AckListener for the request
        Throws:
        DesktopException - if this method fails to add event listener specified
        See Also:
        EventListener, AckListener
      • addEventListener

        public void addEventListener​(String type,
                                     EventListener listener,
                                     AckListener callback)
                              throws DesktopException
        Registers an event listener on the specified event
             Supported system event types are:
         
        Parameters:
        type - Type of the event
        listener - EventListener for the event
        callback - AckListener for the request
        Throws:
        DesktopException - if this method fails to add event listener specified
        See Also:
        EventListener, AckListener