Skip to content

Commit

Permalink
feat: connect_timeout in Streaming Client
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfaust committed Sep 21, 2017
1 parent 82c13ab commit a4bc500
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/twitter/streaming/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ module Twitter
property user_agent : String?
property http_client : HTTP::Client

def initialize(@consumer_key, @consumer_secret, @access_token, @access_token_secret, @user_agent = nil)
def initialize(@consumer_key, @consumer_secret, @access_token, @access_token_secret, @user_agent = nil, connect_timeout : Time::Span? = 30.seconds)
@user_agent ||= "CrystalTwitterClient/#{Twitter::Version.to_s}"
consumer = OAuth::Consumer.new(Host, consumer_key, consumer_secret)
access_token = OAuth::AccessToken.new(access_token, access_token_secret)
@http_client = HTTP::Client.new(Host, tls: true)
@http_client.connect_timeout = connect_timeout if connect_timeout
consumer.authenticate(http_client, access_token)
end

Expand Down

0 comments on commit a4bc500

Please sign in to comment.