Class Jabber::Protocol::Connection
In: lib/jabber4r/protocol.rb
Parent: Object

The connection class encapsulates the connection to the Jabber service including managing the socket and controlling the parsing of the Jabber XML stream.

Methods

Constants

DISCONNECTED = 1
CONNECTED = 2

Attributes

host  [R] 
input  [R] 
output  [R] 
port  [R] 
status  [R] 

Public Class methods

Public Instance methods

Adds a filter block/proc to process received XML messages

xml:[String] The xml data to send
proc:[Proc = nil] The optional proc
&block:[Block] The optional block

Closes the connection to the Jabber service

Connects to the Jabber server through a TCP Socket and starts the Jabber parser.

Returns if this connection is connected to a Jabber service

return:[Boolean] Connection status

Returns if this connection is NOT connected to a Jabber service

return:[Boolean] Connection status

Mounts a block to handle exceptions if they occur during the poll send. This will likely be the first indication that the socket dropped in a Jabber Session.

Starts a polling thread to send "keep alive" data to prevent the Jabber connection from closing for inactivity.

Processes a received ParsedXMLElement and executes registered thread blocks and filters against it.

element:[ParsedXMLElement] The received element

Sends XML data to the socket and (optionally) waits to process received data.

xml:[String] The xml data to send
proc:[Proc = nil] The optional proc
&block:[Block] The optional block

[Validate]