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
32           use Net::XMPP;
33
34           $Con = new Net::XMPP::Client();
35
36           $Con->SetCallbacks(...);
37
38           $Con->Execute(hostname=>"jabber.org",
39                         username=>"bob",
40                         password=>"XXXX",
41                         resource=>"Work'
42                        );
43
44           #
45           # For the list of available functions see Net::XMPP::Protocol.
46           #
47
48           $Con->Disconnect();
49

METHODS

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

AUTHOR

147       Ryan Eatmon
148
150       This module is free software, you can redistribute it and/or modify it
151       under the LGPL.
152
153
154
155perl v5.8.8                       2007-04-02              Net::XMPP::Client(3)
Impressum