Class MessageSender

java.lang.Object
com.vaadin.client.communication.MessageSender

public class MessageSender extends Object
MessageSender is responsible for sending messages to the server.

Internally uses XhrConnection and/or PushConnection for delivering messages, depending on the application configuration.

Since:
1.0
Author:
Vaadin Ltd
  • Constructor Details

    • MessageSender

      public MessageSender(Registry registry)
      Creates a new instance connected to the given registry.
      Parameters:
      registry - the global registry
  • Method Details

    • sendUnloadBeacon

      public void sendUnloadBeacon()
    • sendBeacon

      public static void sendBeacon(String url, String payload)
    • sendInvocationsToServer

      public void sendInvocationsToServer()
      Sends any pending invocations to the server if there is no request in progress and the application is running.

      If a request is in progress, this method does nothing and assumes that it is called again when the request completes.

    • send

      protected void send(elemental.json.JsonArray reqInvocations, elemental.json.JsonObject extraJson)
      Makes an UIDL request to the server.
      Parameters:
      reqInvocations - Data containing RPC invocations and all related information.
      extraJson - Parameters that are added to the payload
    • send

      public void send(elemental.json.JsonObject payload)
      Sends an asynchronous or synchronous UIDL request to the server using the given URI.
      Parameters:
      payload - The contents of the request to send
    • setPushEnabled

      public void setPushEnabled(boolean enabled)
      Sets the status for the push connection.
      Parameters:
      enabled - true to enable the push connection; false to disable the push connection.
    • getCommunicationMethodName

      public String getCommunicationMethodName()
      Returns a human readable string representation of the method used to communicate with the server.
      Returns:
      A string representation of the current transport type
    • resynchronize

      public void resynchronize()
      Resynchronize the client side, i.e. reload all component hierarchy and state from the server
    • setClientToServerMessageId

      public void setClientToServerMessageId(int nextExpectedId, boolean force)
      Used internally to update what id the server expects.
      Parameters:
      nextExpectedId - the new client id to set
      force - true if the id must be updated, false otherwise