1Net::Jabber::Component(U3s)er Contributed Perl DocumentatNieotn::Jabber::Component(3)
2
3
4

NAME

6       Net::Jabber::Component - Jabber Component Library
7

SYNOPSIS

9         Net::Jabber::Component is a module that provides a developer easy
10         access to developing server components in the Jabber Instant Messaging
11         protocol.
12

DESCRIPTION

14         Component.pm seeks to provide enough high level APIs and automation of
15         the low level APIs that writing a Jabber Component in Perl is trivial.
16         For those that wish to work with the low level you can do that too,
17         but those functions are covered in the documentation for each module.
18
19         Net::Jabber::Component provides functions to connect to a Jabber
20         server, login, send and receive messages, operate as a server side
21         component, and disconnect.  You can use all or none of the functions,
22         there is no requirement.
23
24         For more information on how the details for how Net::Jabber is written
25         please see the help for Net::Jabber itself.
26
27         For a full list of high level functions available please see
28         Net::Jabber::Protocol and Net::XMPP::Protocol.
29
30   Basic Functions
31           use Net::Jabber;
32
33           $Con = new Net::Jabber::Component();
34
35           $Con->Execute(hostname=>"jabber.org",
36                         componentname=>"service.jabber.org",
37                         secret=>"XXXX"
38                        );
39
40           #
41           # For the list of available functions see Net::XMPP::Protocol.
42           #
43
44           $Con->Disconnect();
45

METHODS

47   Basic Functions
48           new(debuglevel=>0|1|2, - creates the Component object.  debugfile
49               debugfile=>string,   should be set to the path for the debug
50               debugtime=>0|1)      log to be written.  If set to "stdout"
51                                    then the debug will go there.  debuglevel
52                                    controls the amount of debug.  For more
53                                    information about the valid setting for
54                                    debuglevel, debugfile, and debugtime see
55                                    Net::Jabber::Debug.
56
57           AuthSend(secret=>string) - Perform the handshake and authenticate
58                                      with the server.
59
60           Connect(hostname=>string,       - opens a connection to the server
61                       port=>integer,            based on the value of
62                       componentname=>string,    connectiontype.  The only valid
63                       connectiontype=>string)   setting is:
64                                                   accept - TCP/IP remote connection
65                                             In the future this might be used
66                                             again by offering new features.
67                                             If accept then it connects to the
68                                             server listed in the hostname
69                                             value, on the port listed.  The
70                                             defaults for the two are localhost
71                                             and 5269.
72
73                                             Note: A change from previous
74                                             versions is that Component now
75                                             shares its core with Client.  To
76                                             that end, the secret should no
77                                             longer be used.  Call AuthSend
78                                             after connecting.  Better yet,
79                                             use Execute.
80
81           Connected() - returns 1 if the Component is connected to the server,
82                         and 0 if not.
83
84           Disconnect() - closes the connection to the server.
85
86           Execute(hostname=>string,       - Generic inner loop to handle
87                       port=>int,                connecting to the server, calling
88                       secret=>string,           Process, and reconnecting if the
89                       componentname=>string,    connection is lost.  There are four
90                       connectiontype=>string,   callbacks available that are called
91                   connectattempts=>int,     at various places in the loop.
92                   connectsleep=>int)          onconnect - when the component
93                                                           connects to the
94                                                           server.
95                                               onauth - when the component has
96                                                        completed its handshake
97                                                        with the server this
98                                                        will be called.
99                                               onprocess - this is the most
100                                                           inner loop and so
101                                                           gets called the most.
102                                                           Be very very careful
103                                                           what you put here
104                                                           since it can
105                                                           *DRASTICALLY* affect
106                                                           performance.
107                                               ondisconnect - when connection is
108                                                              lost.
109                                               onexit - when the function gives
110                                                        up trying to connect and
111                                                        exits.
112                                             The arguments are passed straight
113                                             on to the Connect function, except
114                                             for connectattempts and
115                                             connectsleep.  connectattempts is
116                                             the number of time that the
117                                             Component should try to connect
118                                             before giving up.  -1 means try
119                                             forever.  The default is -1.
120                                             connectsleep is the number of
121                                             seconds to sleep between each
122                                             connection attempt.
123
124           Process(integer) - takes the timeout period as an argument.  If no
125                              timeout is listed then the function blocks until
126                              a packet is received.  Otherwise it waits that
127                              number of seconds and then exits so your program
128                              can continue doing useful things.  NOTE: This is
129                              important for GUIs.  You need to leave time to
130                              process GUI commands even if you are waiting for
131                              packets.  The following are the possible return
132                              values, and what they mean:
133
134                                  1   - Status ok, data received.
135                                  0   - Status ok, no data received.
136                                undef - Status not ok, stop processing.
137
138                              IMPORTANT: You need to check the output of every
139                              Process.  If you get an undef then the connection
140                              died and you should behave accordingly.
141

AUTHOR

143       Ryan Eatmon
144
146       This module is free software; you can redistribute it and/or modify it
147       under the same terms as Perl itself.
148
149
150
151perl v5.38.0                      2023-07-21         Net::Jabber::Component(3)
Impressum