1Net::STOMP::Client::HeaUrsteBreaCto(n3t)ributed Perl DocNuemte:n:tSaTtOiMoPn::Client::HeartBeat(3)
2
3
4

NAME

6       Net::STOMP::Client::HeartBeat - Heart-beat support for
7       Net::STOMP::Client
8

SYNOPSIS

10         use Net::STOMP::Client;
11         $stomp = Net::STOMP::Client->new(host => "127.0.0.1", port => 61613);
12         ...
13         # can set the desired configuration only _before_ connect()
14         # the client can send heart-beats every 5 seconds
15         $stomp->client_heart_beat(5);
16         # the server should send heart-beats every 10 seconds
17         $stomp->server_heart_beat(10);
18         ...
19         $stomp->connect();
20         ...
21         # can get the negotiated configuration only _after_ connect()
22         printf("negotiated heart-beats: client=%.3f server=%.3f\n",
23             $stomp->client_heart_beat(), $stomp->server_heart_beat());
24

DESCRIPTION

26       This module handles STOMP heart-beat negotiation. It is used internally
27       by Net::STOMP::Client and should not be directly used elsewhere.
28

METHODS

30       This module provides the following methods to Net::STOMP::Client:
31
32       client_heart_beat([VALUE])
33           get/set the client heart-beat
34
35       server_heart_beat([VALUE])
36           get/set the server heart-beat
37
38       last_received()
39           get the time at which data was last received, i.e. read from the
40           network socket
41
42       last_sent()
43           get the time at which data was last sent, i.e. written to the
44           network socket
45
46       beat([OPTIONS])
47           send a NOOP frame (using the noop() method) unless the last sent
48           time is recent enough with regard to the client heart-beat settings
49
50       For consistency with other Perl modules (for instance Time::HiRes),
51       time is always expressed as a fractional number of seconds.
52

HEART-BEATING

54       Starting with STOMP 1.1, each end of a STOMP connection can check if
55       the other end is alive via heart-beating.
56
57       In order to use heart-beating (which is disabled by default), the
58       client must specify what it wants before sending the "CONNECT" frame.
59       This can be done using the "client_heart_beat" and "server_heart_beat"
60       options of the new() method or, this is equivalent, the
61       client_heart_beat() and server_heart_beat() methods on the
62       Net::STOMP::Client object.
63
64       After having received the "CONNECTED" frame, the client_heart_beat()
65       and server_heart_beat() methods can be used to get the negotiated
66       values.
67
68       To prove that it is alive, the client just needs to call the beat()
69       method when convenient.
70
71       To check if the server is alive, the client just needs to compare the
72       current time and what is returned by the last_received() and
73       server_heart_beat() methods. For instance:
74
75         $delta = $stomp->server_heart_beat();
76         if ($delta) {
77             $inactivity = Time::HiRes::time() - $stomp->last_received();
78             printf("server looks dead!\n") if $inactivity > $delta;
79         }
80

SEE ALSO

82       Net::STOMP::Client, Time::HiRes.
83

AUTHOR

85       Lionel Cons <http://cern.ch/lionel.cons>
86
87       Copyright (C) CERN 2010-2017
88
89
90
91perl v5.32.0                      2020-07-28  Net::STOMP::Client::HeartBeat(3)
Impressum