Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Pubnub SDK usage pattern [closed]

I am using C# Pubnub SDK. To interact with Pubnub I use Pubnub class. So what are the best practices of managing Pubnub object? I assume it is quite heavy. I don't want to create new object whenever I need to do something with Pubnub.

I have a Web application. Can I simply put Pubnub object into a static field and make it available from everywhere in the application? Are there any potential problems with it?

Currently I am using only HereNow pubnub function.

like image 539
Andrei Avatar asked Aug 20 '26 01:08

Andrei


1 Answers

Andrei, you can re-use the object as needed for multiple calls. When you are done with it, to free memory, you can clean it up via the

EndPendingRequests()

method. More info on that here: https://github.com/pubnub/c-sharp/tree/master/csharp.net#object-cleanup

like image 146
Geremy Avatar answered Aug 22 '26 13:08

Geremy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!