IPWorks IoT 2020 Python Edition

Questions / Feedback?

XMPP Class

Properties   Methods   Events   Configuration Settings   Errors  

The XMPP Class is used to create a lightweight messaging client using the XMPP (Jabber) protocol.

Syntax

class ipworksiot.XMPP

Remarks

The XMPP class supports both plaintext and SSL/TLS connections. When connecting over SSL/TLS the on_ssl_server_authentication event allows you to check the server identity and other security attributes. The on_ssl_status event provides information about the SSL handshake. Additional SSL related settings are also supported via the config method.

A call to the connect method will perform the entire logon process after which a on_connected event will fire indicating connection status. For simplicity, the entire interface is synchronous; the class will not return until a call is completed.

After a successful connection, the class will automatically begin the process of receiving the user's buddy list. The class will parse the XML as it comes in from the server and will set the appropriate properties. Once the entire buddy list has been retrieved, a on_sync event will fire.

Sending a message is as simple as calling a single method. One call to the send_message method will cause the class to connect if it has not already done so, send the specified message to a specified user, and return to the original connection state.

The XMPP Class interface supports messaging, list and presence management. Other features of the XMPP protocol are supported through the send_command method and on_pi_trail event.

Example (Connecting and Sending a Message)


IMControl.Connect("myusername", "mypassword")
IMControl.MessageText = "My Message"
IMControl.SendMessage("ToUser")
Example (Sending a Single Message)


IMControl.User = "myusername"
IMControl.Password = "mypassword"
IMControl.MessageText = "My Message"
IMControl.SendMessage("ToUser")

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

auth_domainThe domain under which the user will be authenticated.
auth_methodsControls how the class authenticates itself with the XMPP server.
buddy_countThe number of records in the Buddy arrays.
buddy_groupThis is a comma-separated list of the buddy's associated groups.
buddy_idThis is the jabber id of the buddy.
buddy_nick_nameThe nickname of the buddy, if one exists.
buddy_real_nameThe real name of the buddy.
buddy_subscriptionThis is a list of the subscription status for the buddy.
connectedThis indicates the class's login status.
firewall_auto_detectThis property tells the class whether or not to automatically detect and use firewall system settings, if available.
firewall_typeThis property determines the type of firewall to connect through.
firewall_hostThis property contains the name or IP address of firewall (optional).
firewall_passwordThis property contains a password if authentication is to be used when connecting through the firewall.
firewall_portThis property contains the TCP port for the firewall Host .
firewall_userThis property contains a user name if authentication is to be used connecting through a firewall.
im_portThe server port for XMPP (default 5222).
im_serverThis is the instant messaging server.
local_directoryThe directory to which received files are saved.
local_fileThe path to the file that will be sent.
local_hostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
message_htmlThis is the HTML version of the current message.
message_other_dataThis property contains extra data elements for the current message.
message_subjectThis is the subject of the current message.
message_textThis is the plain text of the current message.
message_threadThis is the thread name of the current message.
message_typeThis is the type of the current message.
passwordThis is the user's password.
presenceThis is the availability of the entity.
resourceThis is the resource for the current session.
server_domainThe XMPP server's domain.
ssl_accept_server_cert_encodedThe certificate (PEM/base64 encoded).
ssl_cert_encodedThe certificate (PEM/base64 encoded).
ssl_cert_storeThe name of the certificate store for the client certificate.
ssl_cert_store_passwordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
ssl_cert_store_typeThe type of certificate store for this certificate.
ssl_cert_subjectThe subject of the certificate used for client authentication.
ssl_enabledWhether TLS/SSL is enabled.
ssl_server_cert_encodedThe certificate (PEM/base64 encoded).
ssl_start_modeDetermines how the class starts the SSL negotiation.
statusDescription of the availability of this entity.
timeoutA timeout for the class.
userThe user portion of this entity's Jabber ID.
user_domainGets or sets the domain value used for Jabber IDs.
user_info_countThe number of records in the UserInfo arrays.
user_info_fieldThis is the name of the current property necessary for registration.
user_info_valueThis is the value for the current registration property, and should be set after calling QueryRegister and before calling Register .

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

addThis method will add an entity to this entity's roster.
cancelThis will cancel another entity's subscription to this entity's presence.
change_passwordThis method will change the current user's password.
change_presenceThis method will set the availability and status of this entity.
configSets or retrieves a configuration setting.
connectThis method will connect the class to the server.
disconnectThis method disconnects the class from the server.
do_eventsThis method processes events from the internal message queue.
interruptInterrupt the current method.
probe_presenceUse this method to probe for another entity's presence.
query_registerThis method queries a server for the necessary registration fields.
registerThis method registers an account with a server.
removeThis method will remove an entity from this entity's roster.
resetReset the class.
retrieve_rosterThis method will retrieve this entity's roster from the server.
send_commandThis method sends a command to the server.
send_fileSends a file to the specified user.
send_messageThis method will send a message to the specified user.
set_user_info_fieldThis method will add a user information field for registration.
subscribe_toUse this method to subscribe to another entity's presence.
unregisterThis method cancels an account with the host.
unsubscribe_toThis method will cancel a subscription to another entity's presence.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_buddy_updateThis event is fired whenever a roster entry is updated.
on_connectedThis event is fired when a connection to the IM Server is completed.
on_connection_statusFired to indicate changes in connection state.
on_disconnectedThis event is fired when the chat service connection is lost.
on_end_transferFired when a file transfer completes.
on_errorThis event is fired when the server sends a protocol error message.
on_iqThis event is fired for IQ messages not normally supported by the class.
on_message_inThis event is fired upon receipt of a message.
on_pi_trailThis event is fired for all protocol messages.
on_presenceThis event is fired when the presence of a subscribed entity changes.
on_ready_to_sendFired when the class is ready to send data.
on_ssl_server_authenticationFired after the server presents its certificate to the client.
on_ssl_statusShows the progress of the secure connection.
on_start_transferFired when a file transfer begins.
on_subscription_requestThis event fires when a subscription request is received.
on_syncThis event fires upon a complete information synchronization with the server.
on_transferFired during file transfer.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

AccessTokenThe OAuth access token used for authentication.
BlockSizeSpecifies the block size for file transfers.
ClientIdThe OAuth client Id used for authentication.
MessageXMLReturns the last root-level element received by the class.
OverwriteSpecifies whether or not to overwrite received files.
ParseHTMLTells XMPP whether or not to parse MessageHTML when it's set.
RetrieveRosterWhether to automatically retrieve the roster when logging in.
SendSubscriptionResponseDetermines whether a response will be sent to a Subscription Request.
UseCompressionSpecified whether or not stream compression is used.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the class binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
OpenSSLCADirThe path to a directory containing CA certificates.
OpenSSLCAFileName of the file containing the list of CA's trusted by your application.
OpenSSLCipherListA string that controls the ciphers to be used by SSL.
OpenSSLPrngSeedDataThe data to seed the pseudo random number generator (PRNG).
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCACertFilePathsThe paths to CA certificate files on Unix/Linux.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCheckCRLWhether to check the Certificate Revocation List for the server certificate.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLNegotiatedCipherReturns the negotiated ciphersuite.
SSLNegotiatedCipherStrengthReturns the negotiated ciphersuite strength.
SSLNegotiatedCipherSuiteReturns the negotiated ciphersuite.
SSLNegotiatedKeyExchangeReturns the negotiated key exchange algorithm.
SSLNegotiatedKeyExchangeStrengthReturns the negotiated key exchange algorithm strength.
SSLNegotiatedVersionReturns the negotiated protocol version.
SSLProviderThe name of the security provider to use.
SSLSecurityFlagsFlags that control certificate verification.
SSLServerCACertsA newline separated list of CA certificate to use during SSL server certificate validation.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SupportedGroupsThe supported groups for ECC.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 Python Edition - Version 20.0 [Build 8265]