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
add_filter    close    connect    delete_filter    is_connected?    is_disconnected?    new    on_connection_exception    parse_failure    poll    receive    send   
Attributes
host  [R] 
input  [R] 
output  [R] 
port  [R] 
status  [R] 
Public Class methods
new(host, port=5222)
Public Instance methods
connect()

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

on_connection_exception(&block)

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.

parse_failure()
is_connected?()

Returns if this connection is connected to a Jabber service

return:[Boolean] Connection status
is_disconnected?()

Returns if this connection is NOT connected to a Jabber service

return:[Boolean] Connection status
receive(element)

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

element:[ParsedXMLElement] The received element
send(xml, proc=nil, &block)

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
poll()

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

add_filter(ref, proc=nil, &block)

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
delete_filter(ref)
close()

Closes the connection to the Jabber service