Class EventMachine::Twitter::Connection
In: lib/em-twitter/connection.rb
Parent: EM::Connection

Methods

Constants

MAX_LINE_LENGTH = 1024*1024 unless defined?(MAX_LINE_LENGTH)
STALL_TIMEOUT = 90 unless defined?(STALL_TIMEOUT)
STALL_TIMER = 10 unless defined?(STALL_TIMER)

Attributes

client  [R] 
headers  [R] 
host  [R] 
options  [R] 
port  [R] 
reconnector  [RW] 

Public Class methods

Public Instance methods

Returns the current state of the auto_reconnect flag.

Determines if the connection should reconnect if the connection closes

Called after the connection to the server is completed. Initiates a

Returns the current state of the gracefully_closed flag gracefully_closed is set to true when the connection is explicitly stopped using the stop method

Immediately reconnects the connection

Returns the current state of the immediate_reconnect flag immediate_reconnect is true when the immediate_reconnect method is invoked on the connection

Returns a status of the connection, if no response was ever received from the server, then we assume a network failure.

Receives responses from the server and passes them on to the HttpParser

Close the connection gracefully, without reconnecting

Called when a connection is disconnected

Protected Instance methods

A utility method used to invoke callback methods against the Client

HttpParser implementation, invoked when a body is received

HttpParser implementation, invoked after response headers are received

Performs the reconnection after x seconds have passed. Reconnection is performed immediately if the argument passed is zero.

Otherwise it will create an EM::Timer that will reconnect

Resets the internals of the connection on initial connection and on reconnections. Clears the response buffer and resets internal state

Handles reconnection to the server when a disconnect occurs. By using a reconnector, it will gradually increase the time between reconnects per Twitter‘s reconnection guidelines.

It‘s important that we try to not add a certificate to the store that‘s already in the store, because OpenSSL::X509::Store will raise an exception.

[Validate]