1Net::XMPP::Client(3)  User Contributed Perl Documentation Net::XMPP::Client(3)
2
3
4

NAME

6       Net::XMPP::Client - XMPP Client Module
7

SYNOPSIS

9         Net::XMPP::Client is a module that provides a developer easy access
10         to the Extensible Messaging and Presence Protocol (XMPP).
11

DESCRIPTION

13         Client.pm uses Protocol.pm to provide enough high level APIs and
14         automation of the low level APIs that writing an XMPP Client in
15         Perl is trivial.  For those that wish to work with the low level
16         you can do that too, but those functions are covered in the
17         documentation for each module.
18
19         Net::XMPP::Client provides functions to connect to an XMPP server,
20         login, send and receive messages, set personal information, create
21         a new user account, manage the roster, and disconnect.  You can use
22         all or none of the functions, there is no requirement.
23
24         For more information on how the details for how Net::XMPP is written
25         please see the help for Net::XMPP itself.
26
27         For a full list of high level functions available please see
28         Net::XMPP::Protocol.
29
30   Basic Functions
31           use Net::XMPP;
32
33           $Con = new Net::XMPP::Client();
34
35           $Con->SetCallbacks(...);
36
37           $Con->Execute(hostname=>"jabber.org",
38                         username=>"bob",
39                         password=>"XXXX",
40                         resource=>"Work'
41                        );
42
43           #
44           # For the list of available functions see Net::XMPP::Protocol.
45           #
46
47           $Con->Disconnect();
48

METHODS

50   Basic Functions
51           new(debuglevel=>0|1|2, - creates the Client object.  debugfile
52               debugfile=>string,   should be set to the path for the debug
53               debugtime=>0|1)      log to be written.  If set to "stdout"
54                                    then the debug will go there.  debuglevel
55                                    controls the amount of debug.  For more
56                                    information about the valid setting for
57                                    debuglevel, debugfile, and debugtime see
58                                    Net::XMPP::Debug.
59
60           Connect(hostname=>string,      - opens a connection to the server
61                   port=>integer,           listed in the hostname (default
62                   timeout=>int             localhost), on the port (default
63                   connectiontype=>string,  5222) listed, using the
64                   tls=>0|1)                connectiontype listed (default
65                                            tcpip).  The two connection types
66                                            available are:
67                                              tcpip  standard TCP socket
68                                              http   TCP socket, but with the
69                                                     headers needed to talk
70                                                     through a web proxy
71                                            If you specify tls, then it TLS
72                                            will be used if it is available
73                                            as a feature.
74
75           Execute(hostname=>string,       - Generic inner loop to handle
76                   port=>int,                connecting to the server, calling
77                   tls=>0|1,                 Process, and reconnecting if the
78                   username=>string,         connection is lost.  There are
79                   password=>string,         five callbacks available that are
80                   resource=>string,         called at various places:
81                   register=>0|1,              onconnect - when the client has
82                   connectiontype=>string,                 made a connection.
83                   connecttimeout=>string,     onauth - when the connection is
84                   connectattempts=>int,                made and user has been
85                   connectsleep=>int,                   authed.  Essentially,
86                   processtimeout=>int)                 this is when you can
87                                                        start doing things
88                                                        as a Client.  Like
89                                                        send presence, get your
90                                                        roster, etc...
91                                               onprocess - this is the most
92                                                           inner loop and so
93                                                           gets called the most.
94                                                           Be very very careful
95                                                           what you put here
96                                                           since it can
97                                                           *DRASTICALLY* affect
98                                                           performance.
99                                               ondisconnect - when the client
100                                                              disconnects from
101                                                              the server.
102                                               onexit - when the function gives
103                                                        up trying to connect and
104                                                        exits.
105                                             The arguments are passed straight
106                                             on to the Connect function, except
107                                             for connectattempts and connectsleep.
108                                             connectattempts is the number of
109                                             times that the Component should try
110                                             to connect before giving up.  -1
111                                             means try forever.  The default is
112                                             -1. connectsleep is the number of
113                                             seconds to sleep between each
114                                             connection attempt.
115
116                                             If you specify register=>1, then the
117                                             Client will attempt to register the
118                                             sepecified account for you, if it
119                                             does not exist.
120
121           Process(integer) - takes the timeout period as an argument.  If no
122                              timeout is listed then the function blocks until
123                              a packet is received.  Otherwise it waits that
124                              number of seconds and then exits so your program
125                              can continue doing useful things.  NOTE: This is
126                              important for GUIs.  You need to leave time to
127                              process GUI commands even if you are waiting for
128                              packets.  The following are the possible return
129                              values, and what they mean:
130
131                                  1   - Status ok, data received.
132                                  0   - Status ok, no data received.
133                                undef - Status not ok, stop processing.
134
135                              IMPORTANT: You need to check the output of every
136                              Process.  If you get an undef then the connection
137                              died and you should behave accordingly.
138
139           Disconnect() - closes the connection to the server.
140
141           Connected() - returns 1 if the Transport is connected to the server,
142                         and 0 if not.
143

AUTHOR

145       Ryan Eatmon
146
148       This module is free software, you can redistribute it and/or modify it
149       under the LGPL.
150
151
152
153perl v5.12.0                      2010-05-04              Net::XMPP::Client(3)
Impressum