static void Main(string[] args) { // Create a new DataSift client var client = new DataSiftClient("DATASIFT_USERNAME", "DATASIFT_APIKEY"); // Compile filter var csdl = @"tag.brand ""Calvin Klein"" { interaction.content contains ""Calvin Klein"" } tag.brand ""GQ"" { interaction.content contains ""GQ"" } tag.brand ""Adidas"" { interaction.content contains ""Adidas"" } return { interaction.content contains_any ""Calvin Klein, GQ, Adidas"" }"; var compiled = client.Compile(csdl); _hash = compiled.Data.hash; _stream = client.Connect(); _stream.OnConnect += stream_OnConnect; _stream.OnMessage += stream_OnMessage; _stream.OnDelete += stream_OnDelete; _stream.OnDataSiftMessage += stream_OnDataSiftMessage; _stream.OnClosed += stream_OnClosed; // Wait for key press before ending example Console.WriteLine("-- Press any key to exit --"); Console.ReadKey(true); }
static void Main(string[] args) { // Create a new DataSift client var client = new DataSiftClient("DATASIFT_USERNAME", "DATASIFT_APIKEY"); // Compile filter var csdl = @"tag.source ""Pandora"" { links.domain == ""pandora.com"" } tag.source ""SoundCloud"" { links.domain == ""soundcloud.com"" } tag.source ""Spotify"" { links.domain == ""spotify.com"" } return { links.domain in ""pandora.com,soundcloud.com,spotify.com"" AND interaction.type == ""twitter"" }"; var compiled = client.Compile(csdl); _hash = compiled.Data.hash; _stream = client.Connect(); _stream.OnConnect += stream_OnConnect; _stream.OnMessage += stream_OnMessage; _stream.OnDelete += stream_OnDelete; _stream.OnDataSiftMessage += stream_OnDataSiftMessage; _stream.OnClosed += stream_OnClosed; // Wait for key press before ending example Console.WriteLine("-- Press any key to exit --"); Console.ReadKey(true); }
public DataSiftStream Connect(bool secure = true, string domain = "stream.datasift.com", bool autoReconnect = true) { var stream = new DataSiftStream(_getConnection, domain, autoReconnect); stream.Connect(_username, _apikey, secure); return stream; }