Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed duplicate file

  • Loading branch information...
commit c9f74dd2a82e96fdeb90c1fa9d1d4ae02813355e 1 parent 989c018
Graham Scott authored
Showing with 1 addition and 74 deletions.
  1. +1 −2  PusherDotNet.Tests/PusherProviderTests.cs
  2. +0 −72 PusherProvider.cs
View
3  PusherDotNet.Tests/PusherProviderTests.cs
@@ -16,8 +16,7 @@ public void CanTriggerPush()
JsonData = @"{""some"":""data""}"
};
- var provider = new PusherProvider("1557", "fe6a55d88fd68f3a42a5", "bcfda4394fe40ad76d47");
- //var provider = new PusherProvider("[YOUR APP ID]", "[YOUR APP KEY]", "[YOUR APP SECRET]");
+ var provider = new PusherProvider("[YOUR APP ID]", "[YOUR APP KEY]", "[YOUR APP SECRET]");
provider.Trigger(request);
}
View
72 PusherProvider.cs
@@ -1,72 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Linq;
-using System.Net;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace PusherDotNet
-{
- public class PusherProvider
- {
- private readonly string _host;
- private readonly string _applicationId;
- private readonly string _applicationKey;
- private readonly string _applicationSecret;
-
- public void PushIt(PusherRequest request)
- {
- var client = new WebClient
- {
- BaseAddress = GetBaseUri(request),
- QueryString = BuildQueryStringCollection(request),
- };
- }
-
- private NameValueCollection BuildQueryStringCollection(PusherRequest request)
- {
- var pairs = new NameValueCollection
- {
- {"auth_key", _applicationKey},
- {"auth_timestamp", _applicationKey},
- {"auth_version", "1.0"},
- {"body_md5", GetMd5Hash(request.JsonData)},
- {"name", request.EventName},
- };
-
- if(!String.IsNullOrEmpty(request.SocketId))
- {
- pairs.Add("socket_id", request.SocketId);
- }
-
- return pairs;
- }
-
- private static string GetMd5Hash(string jsonData)
- {
- return Convert.ToBase64String(new MD5CryptoServiceProvider().ComputeHash(Encoding.Default.GetBytes(jsonData)));
- }
-
- private string GetBaseUri(PusherRequest request)
- {
- return String.Format("/apps/{0}/channels/{1}/events", _applicationId, request.ChannelName);
- }
- }
-
- public class PusherRequest
- {
- public string EventName { get; set; }
- public string ChannelName { get; set; }
- public string JsonData { get; set; }
- public string SocketId { get; set; }
-
-
- public PusherRequest(string channelName)
- {
- ChannelName = channelName;
- }
- }
-}
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.