Giter Site home page Giter Site logo

csharp-client's Introduction

Senstate C#-Client ๐Ÿ‘‹

Install C# Client

Libary Install
Shared Logic Install-Package Senstate.CSharp-Client -Version 0.1.0 Nuget Version
Nuget Downloads
.Net Standard 2 Json/WebSocket Implementations Install-Package Senstate.NetStandard -Version 0.1.0 Nuget Version
Nuget Downloads

Supported Platforms:

  • NetStandard
  • Blazor Server/WASM (Demo soon)

or Visit: Releases to download the Client & NetStandard Dlls.

Reference them as usual

Connect to Senstate

   var webSocket = new NetStandardWebSocketImplementation();
   webSocket.ExceptionThrown += (sender, e) =>  // Optional if you want to catch Connection issues
   {
      throw e.Exception;
   };

   SenstateContext.SerializerInstance = new NetStandardJsonNetImplementation();
   SenstateContext.WebSocketInstance = webSocket;
   SenstateContext.RegisterApp("Your Name");

Sending Data

You can send strings / numbers / (json) objects (see WatcherType Enum)

Create your Watcher:

   var stringWatcher = new Watcher(
      new WatcherMeta
      {
         Tag = "Some Label",
         Type = WatcherType.String, // or Number / Json
         Group = "Example Group 1"  // optional: if you want to group watchers
      }
   );

Send your data:

  stringWatcher.SendData($"This an example Text {i}");

Once there is a connection, the Data will be shown in the Dashboard.

Addtional Example to send objects:

Create your Watcher:

   var objectWatcher = new Watcher(
      new WatcherMeta
      {
         Tag = "Object",  // Just a label for this watcher
         Type = WatcherType.Json,
         Group = "Special"// optional:
      }
   );

Send your data:

   var someObject = new
   {
      example = true,
      sub = new
      {
         data = i
      }
   };

   // Any objects, but they can't have cyclic references
   // So that JsonNet can serialize those
   objectWatcher.SendData(someObject);

Sending Logs

Possible Log-Levels:

  • Debug
  • Info
  • Warn
  • Error
   Logger.SendLog(LoggerType.Debug, $"Debug {i}", someObject);  // optional: someObject
   Logger.SendLog(LoggerType.Info, $"Info {i}");

Sending Errors

   ErrorSender.Send(ex);

Show your support

Give a โญ๏ธ if this project helped you!

If you have features / ideas, open an issue :)

csharp-client's People

Contributors

negue avatar

Watchers

 avatar  avatar

csharp-client's Issues

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.