Git Product home page Git Product logo

channels-examples's Introduction

About

This repository contains sample code for you to get started with the Channels application in IOTA Streams.

You can find documentation for these examples on the IOTA documentation portal.

Getting started

To get started you need Git and Rust installed on your device.

  1. Clone this repository

    git clone https://github.com/JakeSCahill/channels-examples
    cd channels-examples
  2. Open the src/main.rs file and change the author's secret to something secure

    // REPLACE THE SECRET WITH YOUR OWN
    let mut author = Author::new("MYAUTHORSECRET");
  3. Start the author and follow the prompts

    cargo +nightly run --release --bin author

    When you run this command for the first time, it may take a minute or two to download and compile the dependencies.

    In the console, you should see something like the following:

    Creating a new channel
    Channel published
    Channel address: XP9QADNJGJOJTOIZDOFAOFKXQADWDKTGEMHFBNOZ9HROIPMVWPBTCUPOVKUYRKKAAFQ9XDBVSJMDALVZJ
    Sending signed message
    Published signed message
    
    Now, in a new terminal window, use the subscriber to publish a `Subscribe` message on the channel
    
    cargo +nightly run --release --bin subscriber XP9QADNJGJOJTOIZDOFAOFKXQADWDKTGEMHFBNOZ9HROIPMVWPBTCUPOVKUYRKKAAFQ9XDBVSJMDALVZJ AEFYSYRVRKKW9CPBRMXHYDNJJWK KLKGMAAQGXPHEJLQKIPKYPHEAFE
    
    Enter the message identifier of the `Subscribe` message that was published by the subscriber:
  4. Open the bin/subscriber.rs file, and change the subscriber's secret to something secure

     // REPLACE THE SECRET WITH YOUR OWN
    let mut subscriber = Subscriber::new("MYSUBSCRIBERSECRET", true);
  5. Copy the cargo run command and paste it into a new terminal window to start the subscriber

    cargo +nightly run --release --bin subscriber XP9QADNJGJOJTOIZDOFAOFKXQADWDKTGEMHFBNOZ9HROIPMVWPBTCUPOVKUYRKKAAFQ9XDBVSJMDALVZJ AEFYSYRVRKKW9CPBRMXHYDNJJWK KLKGMAAQGXPHEJLQKIPKYPHEAFE

    The first argument is the channel address, the second argument is the Announce message identifier, and the third argument is the SignedPacket message identifier.

    The subscriber needs all this information to get the messages from the channel.

  6. Follow the prompts

    In the console, you should see that the subscriber was able to subscribe to the channel and read the encrypted message.

Supporting the project

Channels is an alpha project that is being developed as a built-in protocol of the Streams framework.

If you want to support the sample code in this repository, consider:

If you want to support the Streams project, please head over to the GitHub repository and take a look at the contribution guidelines.

Joining the discussion

If you want to get involved in discussions about this technology, or you're looking for support, go to the #streams-discussion channel on Discord.

channels-examples's People

Watchers

 avatar

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.