Giter Site home page Giter Site logo

beebotte / bbt_client_dotnet Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 21 KB

This .Net package implements the real time Pub/Sub API of Beebotte, an open cloud platform for the Internet of Things and real time connected applications.

License: MIT License

C# 100.00%

bbt_client_dotnet's Introduction

Beebotte Client .Net SDK

what where
overview http://beebotte.com/overview
tutorials http://beebotte.com/tutorials
source https://github.com/beebotte/bbt_client_dotnet

Bugs / Feature Requests

Think you.ve found a bug? Want to see a new feature in beebotte? Please open an issue in github. Please provide as much information as possible about the issue type and how to reproduce it.

https://github.com/beebotte/bbt_client_dotnet/issues

Install

Nuget Install: https://www.nuget.org/packages/Beebotte.API.Client.Net

Install-package Beebotte.API.Client.Net

Cloning: Clone the source code from github

git clone https://github.com/beebotte/bbt_client_dotnet.git

Usage

To use the library, you need to be a registered user. If this is not the case, create your account at http://beebotte.com and note your access credentials.

As a reminder, Beebotte resource description uses a two levels hierarchy:

  • Channel: physical or virtual connected object (an application, an arduino, a coffee machine, etc) providing some resources
  • Resource: most elementary part of Beebotte, this is the actual data source (e.g. temperature from a domotics sensor)

Beebotte Constructor

Use your account API and secret keys to initialize Beebotte connector:

string accesskey  = "YOUR_API_KEY";
string secretkey  = "YOUR_SECRET_KEY";
string hostname   = "http://ws.beebotte.com";
var connector = new Connector(accesskey, secretkey, hostname);

Connecting and subscribing to a resource

After having initialized Beebotte connector, use the 'Connect' method To connect to Beebotte:

connector.Connect();

In order to subscribe to a resource:

string channelName  = "YOUR_Channel"; //the channel name to subscribe to
string resourceName  = "YOUR_Resource"; //the resource to subscribe to
bool isPrivateChannel = true; //Boolean indicating if the channel is private
bool readAccess = true; //Boolean indicating if the connection has read access on the channel/resource
bool writeAccess = true; //Boolean indicating if the connection has write access on the channel/resource

connector.OnConnected += (u, m) =>
  {
      var subscription = connector.Subscribe(channelName, resourceName , isPrivateChannel, readAccess , writeAccess);
      subscription.OnMessage += (i, n) =>
      {
          System.Console.WriteLine(n.Message.data); //Add here the code you want to execute on message received.
      };
  };

Writing Data

You can write data to the resource you're subscribed to using:

connector.Write(channelName, resourceName, isPrivateChannel, dataToWrite);

Publishing Data

You can publish data to the resource you're subscribed to using:

connector.Publish(channelName, resourceName, isPrivateChannel, dataToPublish);

License

Copyright 2013 - 2017 Beebotte.

The MIT License

bbt_client_dotnet's People

Contributors

iotier avatar bachwehbi avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

bbt_client_dotnet's Issues

Per subscription callback function

It would be nice to let the user define his callback function when registering to specific channel/resource.

Now we have a single on message callback for all subscriptions.

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.