Coder Social home page Coder Social logo

pusher-http-dotnet's People

Contributors

agatav avatar bcuff avatar benjamin-tang-pusher avatar ciscoheat avatar damdo avatar draftkings avatar erwin42 avatar ewmy avatar gnieto avatar grahamscott avatar hamchapman avatar imaji avatar kn100 avatar leggetter avatar mdpye avatar meenaalfons avatar pusher-ci avatar topliceanu avatar zimbatm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pusher-http-dotnet's Issues

Data payload in Trigger returning Microsoft DateFormat

{
"DeliveryBatchId": "8E040436-DAEA-5E72-A237-123035F31F33",
"TotalItemsPicked": 30,
"TotalTimeTaken": 291,
"StartTime": "/Date(1488207570653)/",
"EndTime": "/Date(1488207861600)/"
}

Is it possible to change the DateTime serializer format to ISO?

Add option for configurable argument for timeout

Currently the the timeout for PusherRestClient is determined by the default timeout in the dotnet http client library:

This is currently set at 100 seconds:

https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.timeout?view=netcore-3.1

This is an extremely long timeout and it would be helpful to be able to override this. It should be possible by adding an optional argument for PusherRestClient -

_httpClient = new HttpClient { BaseAddress = baseAddress };

TriggerResult exception text should include content

My TriggerAsync call is failing and falling into catch() block of TriggerResult. The exception text " The response body from the Pusher HTTP endpoint could not be parsed as JSON:
System.Net.Http.StreamContent". It is not including the response that failed to parse.

Note: the response from the server was "Invalid signature: you should have sent HmacSHA256Hex... "
(had keys crossed up). Curious that plain text is returned with accept: application/json header.

Better logging solution

Right now it's pretty tricky to debug what's going on with the internals of the library. We need a solid logging solution.

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

Support .NET Standard

Hi, I'm using your library in an app that I'm porting to .NET Core, and would be really useful if it supported .NET Standard 2.0 as well as .NET Framework?

Is that something you'd be happy with? If so, I can send a PR for the changes?

Exception thrown windows machine with FIPS enabled

When PusherServer is used on a machine with FIPS enabled, a runtime exception is thrown ": This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms" in CryptoHelper.GetMd5Hash() due to MD5 not being validated as FIPS compliant.

That said, the intent is to just create a hash, not actually secure anything. A solution that would allow PusherServer to run on a FIPS enabled environment is to "roll your own Md5" which is pretty straightforward
https://stackoverflow.com/a/52166330/600299

Would you accept a PR for this?

Authentication failed because the remote party has closed the transport stream.

I am getting a weird issue trying to peruse the .NET library for Pusher.

Using the latest (4.1.0), and following the guidelines provided (in the Getting Started Tab for ASP.NET):

https://dashboard.pusher.com/apps/#######/getting_started

I am getting the error:
Authentication failed because the remote party has closed the transport stream.

I tried to peruse the old .NET package (3.0)

and in my code:

 var options = new PusherOptions
{
  Cluster = "us2",
  Encrypted = true
};
var pusher = new Pusher("#######", "********", "*******", options);
pusher.Trigger("channel", "event", data);

I am getting the error object not set to an instance of an object. Expanding the exception details does not provide any context whatsoever.

I'd appreciate some insight on the way forward to resolve this. As of now, I am already hitting a wall on what to do further to have my application code working.

Random exception

Sometimes i receive this exception:

message:

Object reference not set to an instance of an object.

stack:

at PusherServer.TriggerResult..ctor(IRestResponse response)
at PusherServer.Pusher.<>c__DisplayClass1.<TriggerAsync>b__0(IRestResponse baseResponse)
   at RestSharp.Http.ResponseCallback(IAsyncResult result, Action`1 callback)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.HttpWebRequest.SetResponse(Exception E)
   at System.Net.ConnectionReturnResult.SetResponses(ConnectionReturnResult returnResult)
   at System.Net.Connection.ReadComplete(Int32 bytesRead, WebExceptionStatus errorStatus)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Security._SslStream.ProcessReadErrorCode(SecurityStatus errorCode, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest, Byte[] extraBuffer)
   at System.Net.Security._SslStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security._SslStream.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
   at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
   at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
   at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)</StackTrace><ExceptionString>System.NullReferenceException: Object reference not set to an instance of an object.
   at PusherServer.TriggerResult..ctor(IRestResponse response)
   at PusherServer.Pusher.&amp;lt;&amp;gt;c__DisplayClass1.&amp;lt;TriggerAsync&amp;gt;b__0(IRestResponse baseResponse)
   at RestSharp.Http.ResponseCallback(IAsyncResult result, Action`1 callback)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.HttpWebRequest.SetResponse(Exception E)
   at System.Net.ConnectionReturnResult.SetResponses(ConnectionReturnResult returnResult)
   at System.Net.Connection.ReadComplete(Int32 bytesRead, WebExceptionStatus errorStatus)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Security._SslStream.ProcessReadErrorCode(SecurityStatus errorCode, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest, Byte[] extraBuffer)
   at System.Net.Security._SslStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security._SslStream.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
   at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
   at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
   at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

InvalidOperationException "You cannot trigger to multiple channels when using encrypted channels."

I am implementing channel encryption within a project:

public async Task<ITriggerResult> TriggerAsync( string[] channelNames, string eventName, object data, ITriggerOptions options = null)

We use ability to trigger across multiple channels in quite a few places. I have now changed this to use TriggerAsync with a single channel name, but this just feels like a work around.

Can anybody confirm if this is safe to do, and is there a specific reason why you cannot trigger on multiple channels when using encryption? Is this just a current limitation of the library. Or a limitation of pusher.

Many thanks

System.IO.IOException: The response ended prematurely.

I'm getting quite a few exceptions when calling TriggerAsync: System.IO.IOException: The response ended prematurely.

I see about 20 of these per day (however, >99% of my push requests go through without an exception). I don't know if the push request with these exceptions is accepted by the server or not.

Here's a sample stack trace:

File ["System.Net.Http.HttpConnection+<SendAsyncCore>d__60"], line 6122 col 0 in System.Net.Http.HttpConnection+<SendAsyncCore>d__60.MoveNext()
File ["System.Runtime.ExceptionServices.ExceptionDispatchInfo"], line 17 col 0 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 0 col 0 in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 46 col 0 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
File ["System.Net.Http.HttpConnectionPool+<SendWithVersionDetectionAndRetryAsync>d__83"], line 1612 col 0 in System.Net.Http.HttpConnectionPool+<SendWithVersionDetectionAndRetryAsync>d__83.MoveNext()
File ["System.Runtime.ExceptionServices.ExceptionDispatchInfo"], line 17 col 0 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 0 col 0 in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 46 col 0 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
File ["System.Net.Http.DiagnosticsHandler+<SendAsyncCore>d__8"], line 1086 col 0 in System.Net.Http.DiagnosticsHandler+<SendAsyncCore>d__8.MoveNext()
File ["System.Runtime.ExceptionServices.ExceptionDispatchInfo"], line 17 col 0 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 0 col 0 in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 46 col 0 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
File ["System.Net.Http.RedirectHandler+<SendAsync>d__4"], line 1045 col 0 in System.Net.Http.RedirectHandler+<SendAsync>d__4.MoveNext()
File ["System.Runtime.ExceptionServices.ExceptionDispatchInfo"], line 17 col 0 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 0 col 0 in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 46 col 0 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
File ["System.Net.Http.HttpClient+<<SendAsync>g__Core|83_0>d"], line 534 col 0 in System.Net.Http.HttpClient+<<SendAsync>g__Core|83_0>d.MoveNext()
File ["System.Runtime.ExceptionServices.ExceptionDispatchInfo"], line 17 col 0 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 0 col 0 in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 46 col 0 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
File ["PusherServer.RestfulClient.PusherRestClient+<ExecutePostAsync>d__11"], line 389 col 0 in PusherServer.RestfulClient.PusherRestClient+<ExecutePostAsync>d__11.MoveNext()
File ["System.Runtime.ExceptionServices.ExceptionDispatchInfo"], line 17 col 0 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 0 col 0 in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 46 col 0 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
File ["PusherServer.Pusher+<TriggerAsync>d__14"], line 272 col 0 in PusherServer.Pusher+<TriggerAsync>d__14.MoveNext()
File ["System.Runtime.ExceptionServices.ExceptionDispatchInfo"], line 17 col 0 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 0 col 0 in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
File ["System.Runtime.CompilerServices.TaskAwaiter"], line 46 col 0 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
File ["PusherServer.Pusher+<TriggerAsync>d__13"], line 196 col 0 in PusherServer.Pusher+<TriggerAsync>d__13.MoveNext()

It appears that the behaviour is due to the server closing the connection early.

What is the suggested way of dealing with this issue? I don't want to catch all exceptions as there might be actual issues, but I'm confused about what to do here.

It feels like an official SDK should curate these errors and tell the user whether they are success or failure or whether we should retry or similar.

Provide an option to triggerAsync on already serialsied data

We are encountering the issue of pusher messages being too large (over 10 kb) in our solution. As such to avoid this situation we need to check the size of the data before sending it. To do this we need to serialize the data ourself and check the length before sending the data. We are sending millions of messages per day so it would be nice if we could send a serialize json string to pusher instead of having an object. This way we could avoid having the expensive serialize operation having to happen twice per message.

public async Task TriggerAsync(
string[] channelNames,
string eventName,
string data
)

Improved error handling of trigger requests

The library does not fail gracefully in the event that the TriggerResult is null - typically caused by a network issue. We should handle this gracefully and prevent system crashes when such an error is encountered.

No notify when device was offline

We implement pusher on server and notify all client by Channels
when device is online work well but while the offline device will be online not any notify and notification on devices ?
where is problem?
thanks.

Pusher: TriggerResponseException

Hey

I am trying to setup pusher. I've create an account, set in the different keys, and triple checked that they are correct. But everytime I try to triggerasync i throws.

PusherServer.Exceptions.TriggerResponseException: The response body from the Pusher HTTP endpoint could not be parsed as JSON

Get any ideas why?
There is no problem with subscribing to the channel in my react code, and I can send events from the debug console on my account.

    [HttpPost("select")]
    public async Task<ActionResult> Select([FromForm] SelectBooth booth ) {
        var options = new PusherOptions {
            Cluster = "eu",
            Encrypted = true
        };

        var pusher = new Pusher(
          "515429",
          "c1f5fd106f027f2ae68a",
          "910b583663118349df9e");

        var result = await pusher.TriggerAsync(
          "3e105489-9dba-4d9b-9dba-40c49437935b",
          "booth-seleceted",
          new { message = "hello world" });

        return NoContent();
    }

Error with dotnet client

Using PusherClient 0.5.1 with WebSocket4Net 0.15.2.

After a pile of NuGet updates, my existing code now breaks when I try to Connect(). As below:

        var pusher = new Pusher("redacted");
        pusher.Connect();

Error is:

System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'Void WebSocket4Net.WebSocket..ctor(System.String, System.String, System.Collections.Generic.List1<System.Collections.Generic.KeyValuePair2<System.String,System.String>>, System.Collections.Generic.List1<System.Collections.Generic.KeyValuePair2<System.String,System.String>>, System.String, System.String, WebSocket4Net.WebSocketVersion, System.Net.EndPoint)'.
Source=PusherClient
StackTrace:
at PusherClient.Connection.Connect()
at PusherClient.Pusher.Connect()

TriggerAsync returning void?

Hi!

I don't really get this. All you examples and source code show pusher.TriggerAsync returning Task. But when I use the code from C# (PuserServer version 3.0.0) it shows all versions of the method returning void and a different method profile than shown in your docs. "Simplest" profile with TriggerAsync(channel, event, data) is also not available.
Normal Trigger works as expected. This all seems very strange to me, but I cannot find any explanation in my setup.

Any idea? Thanks.
/Jacob

image

image

image

App key romaniaroleplay2021 not in this cluster. Did you forget to specify the cluster?

Hey! I have a problem with my pusher Client. I can't figure out how to connect to my Laravel pusher Server.

pusher = new Pusher("romaniaroleplay2021", new PusherOptions {
  Authorizer = new HttpAuthorizer("http://localhost:6001"),
  Encrypted = false,
  Cluster = "mt1",
});
PUSHER_APP_ID=rorpucp
PUSHER_APP_KEY=romaniaroleplay2021
PUSHER_APP_SECRET=rorp20212011
PUSHER_APP_CLUSTER=mt1

eventName might contain double escaped strings

Hello,

I have an issue in combination with a Laravel application, where I need to add the namespace to the event name. Something like this:

Task<ITriggerResult> resultTask = pusher.TriggerAsync("my-channel", @App\Events\my-event", "some data");

Will result in an event being fired with the event name being "App\Events\my-event". Somehow the escaped string gets translated in a string with double backslashes instead of single ones.

Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4001,"message":"App key 914447 not in this cluster. Did you forget to specify the cluster?"}}}

class App {
constructor() {
this.pusher = null;
this.chart = null;
this.threshold = 505;
this.initializeChart();
this.initializePusher();
}

initializePusher() {
  Pusher.logToConsole = true;

  this.pusher = new Pusher('914447', {
    cluster: 'us2',
    encrypted: true
  });

  this.pusher.connection.bind('connected', function() { socketId = this.pusher.connection.socket_id; });

  this.subscribeToEventChannel();
}

subscribeToEventChannel() {
  const channel = this.pusher.subscribe('trade');
  channel.bind('stock', data => {
    this.updateChartData(data)
  });
}

updateChartData(data) {
  
  this.chart.data.labels.push(data.Timestamp.split(' ')[1].split('.')[0]);
  this.chart.data.datasets[0].data.push(data.Price);
  document.getElementById('price').innerHTML = data.Price;

  this.chart.data.datasets.forEach(dataset => {
    var currentPrice = document.getElementById('price');
    var tag = currentPrice.innerHTML;
    tag = data.Price;
    this.flashColor(this.threshold, tag, currentPrice);
  });
  this.chart.update();
}

flashColor(threshold, tag, currentPrice) {
  let color = " ";

  if (tag > threshold ) {
    color = "green";
  } else if(tag == threshold){
    color = "blue";
  } else {
    color = "red";
  }

  currentPrice.style.color = color;
  currentPrice.style.fontWeight = "bolder";
}

initializeChart() {
  const ctx = document.getElementById('chart').getContext('2d');
  const data = {
    labels: [],
    datasets: [
      {
        label: 'GOOG',
        backgroundColor: 'rgb(125, 195, 242)',
        borderColor: 'rgb(54, 162, 235)',
        data: [],
        // fill: false
      }
    ]
  };

  this.chart = new Chart(ctx, {
    type: 'line',
    data: data,
    options: {
      responsive: true,
      title: {
        display: true,
        text: 'Chart.js Line Chart'
      },
      tooltips: {
        mode: 'index',
        intersect: false
      },
      hover: {
        mode: 'nearest',
        intersect: true
      },
      scales: {
        xAxes: [
          {
            display: true,
            scaleLabel: {
              display: true,
              labelString: 'Time  '
            }
          }
        ],
        yAxes: [
          {
            display: true,
            scaleLabel: {
              display: true,
              labelString: 'Price'
            },
            ticks: {
              min: 504,
              max: 507
          }
          }
        ]
      }
    }
  });
}

}

new App();

help

Update nuget feed with the latest version.

Hey guys I have latest version of pusher from nuget 2.1.1.1 which lacks some features like Cluster which is critical for me because I'm in europe.

image

Can you please push the latest version of your repo to Nuget.

The response body from the Pusher HTTP endpoint could not be parsed as JSON

_pusher = new Pusher(settings.AppId, settings.Key, settings.Key, new PusherOptions {Encrypted = true});
var triggerResult = await _pusher.TriggerAsync(channelName, @event, eventParams);

gives me exception:

The response body from the Pusher HTTP endpoint could not be parsed as JSON: System.Net.Http.StreamContent

StackTrace:

Exception PusherServer.Exceptions.TriggerResponseException was thrown: The response body from the Pusher HTTP endpoint could not be parsed as JSON:
System.Net.Http.StreamContent in PusherServer.Core at PusherServer.TriggerResult..ctor(HttpResponseMessage response, String responseContent)
at PusherServer.RestfulClient.PusherRestClient.d__8.MoveNext()

Any ideas? I'm using Net Core 1.1.2 and PusherServer 4.1.0

Using PursherClient library in .Net Framework 4.7 gets an error in TriggerAsync

Hello,

I need to use PusherServer library in a .Net Framework 4.7 application but when I use the method TriggerAsync I get the next error:

Could not load file or assembly 'PusherServer.Core, Version=4.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

It seems that the library is not working for this .Net Framework version. What can i do to send a notifications from this app type?

Regards.

Need clearer documentation on the recommended lifetime of Pusher, PusherOptions

If I'm reading the code correctly it appears that a new instance of HttpClient is created every time a PusherOptions is created. According to Microsoft (https://docs.microsoft.com/en-us/azure/architecture/antipatterns/improper-instantiation/) this technique can lead to socket exhaustion:

These classes are intended to be instantiated once and reused throughout the lifetime of an application. However, it's a common misunderstanding that these classes should be acquired only as necessary and released quickly. (The ones listed here happen to be .NET libraries, but the pattern is not unique to .NET.) The following ASP.NET example creates an instance of HttpClient to communicate with a remote service. You can find the complete sample here.

...

In a web application, this technique is not scalable. A new HttpClient object is created for each user request. Under heavy load, the web server may exhaust the number of available sockets, resulting in SocketException errors.

The docs should say that Pusher (or at least PusherOptions) is intended to be a singleton in order to prevent socket leaks.

What should be the scope of Pusher instance

Hi,

Our API should send Pusher notifications in certain endpoints.
Should we create new Pusher for each HTTP request or should we create Pusher singleton and reuse it every time?

Basically what Pusher scope should be used - Singleton, Scoped or Transient?

Thanks!

App key "Key"not in this cluster. Did you forget to specify the cluster?

I keep getting this error even thought this is the correct app key. I have tried multiple clusters but none seem to work also made multiple new projects.

my Controller
`private Pusher pusher;
//class constructor
public ChatController()
{
var options = new PusherOptions();
options.Cluster = "us2";

        pusher = new Pusher(
            "757549",
            "de7472cb799f79debc6e",
            "f14740af33b9ee255162",
            options
        );
    }`

my javascript
//Pusher client side setup var pusher = new Pusher('757549', { cluster: 'us2' }); pusher.connection.bind('connected', function() { socketId = pusher.connection.socket_id; });

Broken due to breaking change in RestSharp

Due to a breaking change in 104.5 for the BaseUrl in the RestSharp dependency, this library no longer works. Returned error is:
Method not found: 'Void RestSharp.IRestClient.set_BaseUrl(System.String)'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.