Class AbstractProtocolHandler

java.lang.Object
com.openfin.desktop.channel.AbstractProtocolHandler
Direct Known Subclasses:
ClassicProtocolHandler, WebRtcProtocolHandler

public class AbstractProtocolHandler
extends java.lang.Object
  • Field Details

  • Constructor Details

  • Method Details

    • createProtocolHandler

      public static AbstractProtocolHandler createProtocolHandler​(ProtocolOptions options, Channel channel)
    • getProtocolOptions

      public ProtocolOptions getProtocolOptions()
    • getChannelConnectPayload

      public org.json.JSONObject getChannelConnectPayload​(java.lang.Object connectPayload) throws java.lang.Exception
      create payload for connecting to provider. The payload include "offer" object
      Returns:
      connect payload
      Throws:
      java.lang.Exception - Exception
    • getSupportedOfferProtocol

      protected org.json.JSONObject getSupportedOfferProtocol()
    • setClientEndpointIdentity

      public void setClientEndpointIdentity​(EndpointIdentity endpointIdentity)
    • processConnectAnswer

      public java.util.concurrent.CompletionStage<java.lang.Boolean> processConnectAnswer​(org.json.JSONObject res)
      Process connection answer response from a channel provider with connect-to-channel message
      Parameters:
      res - response from a provider
      Returns:
      CompletionStage with true as the answer is accepted
    • acceptAnswer

      protected void acceptAnswer​(org.json.JSONObject answer, java.util.concurrent.CompletableFuture<java.lang.Boolean> future) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • getChannelCreatePayload

      public org.json.JSONObject getChannelCreatePayload()
    • getSupportedAnswerProtocol

      protected org.json.JSONObject getSupportedAnswerProtocol()
    • processConnectOffer

      public org.json.JSONObject processConnectOffer​(org.json.JSONObject offer)
      Process connection offer from a channel client for a provider
      Parameters:
      offer - offer object from channel client
      Returns:
      answer object if the offer is accepted
    • acceptOffer

      protected void acceptOffer​(org.json.JSONObject offer) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • getChannel

      public Channel getChannel()
    • initializeClient

      public void initializeClient() throws java.lang.Exception
      Throws:
      java.lang.Exception
    • initializeProvider

      public void initializeProvider​(EndpointIdentity endpointIdentity, EndpointIdentity clientEndpointIdentity) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • sendChannelMessage

      public void sendChannelMessage​(java.lang.String action, org.json.JSONObject destionationIdentity, org.json.JSONObject providerIdentity, org.json.JSONObject actionPayload, AckListener ackListener)
    • sendChannelMessageAsync

      public java.util.concurrent.CompletableFuture<Ack> sendChannelMessageAsync​(java.lang.String action, org.json.JSONObject destionationIdentity, org.json.JSONObject providerIdentity, java.lang.Object actionPayload)
    • cleanup

      protected void cleanup()
    • getOfferProtocolByType

      public static org.json.JSONObject getOfferProtocolByType​(org.json.JSONObject offer, ProtocolOptions options)