Class ServerConnectionBuilder

java.lang.Object
com.levigo.jadice.web.conn.client.internal.ServerConnectionBuilderInternal
com.levigo.jadice.web.conn.client.ServerConnectionBuilder

public class ServerConnectionBuilder extends com.levigo.jadice.web.conn.client.internal.ServerConnectionBuilderInternal
This factory creates a ServerConnection that is able to communicate with the server side end point. Three communication methods are available:
  • WebSocket
  • Server Sent Events
  • Longpoll
Per default, this factory creates a ServerConnection which connects to a given server. Furthermore, websocket and longpoll is enabled.

The factory creates one of the supported communication methods, depicted by the capabilities of the browsers. Furthermore, certain methods can be disabled optionally.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Builds a new ServerConnection dependent on the capabilities of the browser, predefined end point and restrictions.

    Methods inherited from class com.levigo.jadice.web.conn.client.internal.ServerConnectionBuilderInternal

    buildInternal, setInitialBackoffValue, setLongpollEnabled, setLongtimeReconnectEnabled, setLongtimeReconnectIntervalInMillis, setMaximumRetryDelay, setMaxReconnectAttempts, setRequestAggregationWindow, setServerAddress, setServerSentEventsEnabled, setWebSocketEnabled

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServerConnectionBuilder

      public ServerConnectionBuilder()
  • Method Details

    • build

      public ServerConnection build() throws IOException
      Description copied from class: com.levigo.jadice.web.conn.client.internal.ServerConnectionBuilderInternal
      Builds a new ServerConnection dependent on the capabilities of the browser, predefined end point and restrictions.

      First, the build method tries to create a connection using the websocket protocol, if not available or deactivated it tires to create a connection using a server sent event based protocol. If that is also not available or deactivated it falls back to the longpoll method as a last resort.

      Specified by:
      build in class com.levigo.jadice.web.conn.client.internal.ServerConnectionBuilderInternal
      Returns:
      a new transport client, in order to communicate with the server
      Throws:
      IOException - if no transport method was enabled and thus no client could be constructed