Tabnine Logo
Frame$Heartbeat
Code IndexAdd Tabnine to your IDE (free)

How to use
Frame$Heartbeat
in
io.vertx.ext.stomp

Best Java code snippets using io.vertx.ext.stomp.Frame$Heartbeat (Showing top 8 results out of 315)

origin: io.vertx/vertx-stomp

long ping = Frame.Heartbeat.computePingPeriod(
 Frame.Heartbeat.create(client.options().getHeartbeat()),
 Frame.Heartbeat.parse(frame.getHeader(Frame.HEARTBEAT)));
long pong = Frame.Heartbeat.computePongPeriod(
 Frame.Heartbeat.create(client.options().getHeartbeat()),
 Frame.Heartbeat.parse(frame.getHeader(Frame.HEARTBEAT)));
origin: io.vertx/vertx-stomp

/**
 * Creates an instance of {@link io.vertx.ext.stomp.Frame.Heartbeat} from the {@code heartbeat header} of a frame
 * . If the header is {@code null}, the (0,0) configuration is returned.
 *
 * @param header the header
 * @return the heartbeat configuration
 */
public static Heartbeat parse(String header) {
 if (header == null) {
  return new Heartbeat(0, 0);
 } else {
  String[] token = header.split(FrameParser.COMMA);
  return new Heartbeat(Integer.parseInt(token[0]), Integer.parseInt(token[1]));
 }
}
origin: io.vertx/vertx-stomp

   Frame.SERVER, Server.SERVER_NAME,
   Frame.SESSION, sf.connection().session(),
   Frame.HEARTBEAT, Frame.Heartbeat.create(sf.connection().server().options().getHeartbeat()).toString()), null));
});
origin: eventuate-clients/eventuate-client-java

private Buffer getConnectFrame(String host) {
 Headers headers = Headers.create();
 String accepted = getAcceptedVersions();
 if (accepted != null) {
  headers.put(Frame.ACCEPT_VERSION, accepted);
 }
 if (!options.isBypassHostHeader()) {
  headers.put(Frame.HOST, host);
 }
 if (options.getVirtualHost() != null) {
  headers.put(Frame.HOST, options.getVirtualHost());
 }
 if (options.getLogin() != null) {
  headers.put(Frame.LOGIN, options.getLogin());
 }
 if (options.getPasscode() != null) {
  headers.put(Frame.PASSCODE, options.getPasscode());
 }
 headers.put(Frame.HEARTBEAT, Frame.Heartbeat.create(options.getHeartbeat()).toString());
 Frame.Command cmd = options.isUseStompFrame() ? Frame.Command.STOMP : Frame.Command.CONNECT;
 final Frame frame = new Frame(cmd, headers, null);
 return frame.toBuffer();
}
origin: io.eventuate.client.java/eventuate-client-java-http-stomp

private Buffer getConnectFrame(String host) {
 Headers headers = Headers.create();
 String accepted = getAcceptedVersions();
 if (accepted != null) {
  headers.put(Frame.ACCEPT_VERSION, accepted);
 }
 if (!options.isBypassHostHeader()) {
  headers.put(Frame.HOST, host);
 }
 if (options.getVirtualHost() != null) {
  headers.put(Frame.HOST, options.getVirtualHost());
 }
 if (options.getLogin() != null) {
  headers.put(Frame.LOGIN, options.getLogin());
 }
 if (options.getPasscode() != null) {
  headers.put(Frame.PASSCODE, options.getPasscode());
 }
 headers.put(Frame.HEARTBEAT, Frame.Heartbeat.create(options.getHeartbeat()).toString());
 Frame.Command cmd = options.isUseStompFrame() ? Frame.Command.STOMP : Frame.Command.CONNECT;
 final Frame frame = new Frame(cmd, headers, null);
 return frame.toBuffer();
}
origin: io.vertx/vertx-stomp

private Frame getConnectFrame(String host) {
 Headers headers = Headers.create();
 String accepted = getAcceptedVersions();
 if (accepted != null) {
  headers.put(Frame.ACCEPT_VERSION, accepted);
 }
 if (!options.isBypassHostHeader()) {
  headers.put(Frame.HOST, host);
 }
 if (options.getVirtualHost() != null) {
  headers.put(Frame.HOST, options.getVirtualHost());
 }
 if (options.getLogin() != null) {
  headers.put(Frame.LOGIN, options.getLogin());
 }
 if (options.getPasscode() != null) {
  headers.put(Frame.PASSCODE, options.getPasscode());
 }
 headers.put(Frame.HEARTBEAT, Frame.Heartbeat.create(options.getHeartbeat()).toString());
 Frame.Command cmd = options.isUseStompFrame() ? Frame.Command.STOMP : Frame.Command.CONNECT;
 return new Frame(cmd, headers, null);
}
origin: io.vertx/vertx-stomp

private void handleConnect(Frame frame, StompServerConnection connection) {
 Handler<ServerFrame> handler;
 Handler<StompServerConnection> pingH;
 synchronized (this) {
  handler = connectHandler;
  pingH = pingHandler;
 }
 // Compute heartbeat, and register pinger and ponger
 // Stomp server acts as a client to call the computePingPeriod & computePongPeriod method
 long ping = Frame.Heartbeat.computePingPeriod(
  Frame.Heartbeat.create(connection.server().options().getHeartbeat()),
  Frame.Heartbeat.parse(frame.getHeader(Frame.HEARTBEAT)));
 long pong = Frame.Heartbeat.computePongPeriod(
   Frame.Heartbeat.create(connection.server().options().getHeartbeat()),
   Frame.Heartbeat.parse(frame.getHeader(Frame.HEARTBEAT)));
 connection.configureHeartbeat(ping, pong, pingH);
 // Then, handle the frame.
 if (handler != null) {
  handler.handle(new ServerFrameImpl(frame, connection));
 }
}
origin: io.vertx/vertx-stomp

/**
 * Creates an instance of {@link io.vertx.ext.stomp.Frame.Heartbeat} from the JSON configuration provides in the
 * client / server options. The JSON is structure as follows: {@code {"x": 1000, "y": 1000}}. The {@code x} and
 * {@code y} time are given in milliseconds.
 *
 * @param json the json object configuring the heartbeat.
 * @return the heartbeat configuration
 */
public static Heartbeat create(JsonObject json) {
 return new Heartbeat(
   json.getInteger("x", 0),
   json.getInteger("y", 0));
}
io.vertx.ext.stompFrame$Heartbeat

Javadoc

Represents the heartbeat configuration. Heartbeat determine when a party involved in the exchange (either the client or the server) can detect the inactivity of the other party and close the connection. Configuration is made in the heartbeat header.

This class is thread-safe.

Most used methods

  • create
    Creates an instance of io.vertx.ext.stomp.Frame.Heartbeat from the JSON configuration provides in th
  • toString
  • <init>
  • computePingPeriod
    Computes the ping period. The party must send a ping to the other party every x milliseconds, where
  • computePongPeriod
    Computes the pong period. The party can consider the other party inactive when it did not receives a
  • parse
    Creates an instance of io.vertx.ext.stomp.Frame.Heartbeat from the heartbeat header of a frame . If

Popular in Java

  • Making http requests using okhttp
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Collectors (java.util.stream)
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now