Skip to content

Configuration

linvi edited this page Oct 8, 2016 · 3 revisions

Overview

TweetinviConfig gives you access to multiple properties that you can configure to change how the library works. It includes the configuration of proxy, timeout and rate limits.

Proxy

ApplicationSettings vs CurrentThreadSettings

TweetinviConfig gives you access to 2 sets of configuration.

  • TweetinviConfig.ApplicationSettings is an application wide configuration that will be used as the default configuration each time a new thread is created. It means that every time a child thread is created from this thread it will use a clone the TweetinviConfig.ApplicationSettings configuration.
  • TweetinviConfig.CurrentThreadSettings contains the configuration used only by the current thread.

IMPORTANT : When changing values from ApplicationSettings, the CurrentThreadSettings will not be impacted. Which mean that if you want to change both the application wide configuration and the current thread configuration, you will have to configure both of them.

You can do that by duplicating your code or by using the InitialiseFrom method.

TweetinviConfig.CurrentThreadSettings.InitialiseFrom(TweetinviConfig.ApplicationSettings);

Proxy

If you want to use a proxy Tweetinvi allow you to configure it directly in the TweetinviConfig.

// Simple proxy
TweetinviConfig.CurrentThreadSettings.ProxyURL = "http://228.23.13.21:4287";

// Proxy with password
TweetinviConfig.CurrentThreadSettings.ProxyURL = "http://username:password@228.23.13.21:4287";

I have been reported that sometimes the proxy is not correctly applied. With not further information I have not fixed this problem but if you happen to encounter the same issue please try the following in your web.config or app.config.

<defaultProxy useDefaultCredentials="false">
    <proxy usesystemdefault="true" proxyaddress="<proxy address>" bypassonlocal="true" />
</defaultProxy>
Clone this wiki locally