The Magistral Data Stream Network

The elastic infrastructure to build and connect your realtime IoT apps
GETTING STARTED

Start using Magistral Data Streaming service is very simple and takes only a few steps:

  • 1
    Create App, topic, channels. Get pub/sub/secret keys.
    The first initial step for every project will be creation of app and topics. Every app has its own unique pub and sub keys you can find in its page. The third key you need to connect to Magistral Network is a secret key, which is generated automatically and can be found in user management panel.
  • 2
    Choose SDK and create Magistral Instance
    Magistral m = new Magistral(‘pubKey’, ‘subKey’, ‘secretKey’);
    Using one of more than 10 SDKs, create Magistral application instance and provide publish / subscribe / secret key to connect to the network and use available API functions.
  • 3
    Subscribe
    m.subscribe("topic", new MessageListener() {
    public void messageReceived(MessageEvent e) {
    String topic = e.topic();
    int channel = e.channel();
    byte[] message = e.msgBody();
    System.out.println(new
    String(message,StandardCharsets.UTF_8));
    }
    });
    When connection to Magistral Network has been established you can subscribe on existing topic and receive all messages sent over it.
  • 4
    Publish
    byte[] msg = "magistral".getBytes(StandardCharsets.UTF_8);
    m.publish("topic", 0, msg);
    To receive something sent via the topic you subscribed on, just publish a message.
  • 5
    Get last messages
    Future res = magistral.history(“topic”, “channel”, 10);
    You can easily rewind and see the last n-messages sent over the topic of interest.
  • 6
    Congratulations, it works!
    Now you can seamlessly connect your real-time applications to Magistral and enjoy unmatchable speed, security and reliability of the service. Evaluate other functionalities, provided by Magistral API which can ease and speed up integration with your app. Sign in to Magistral service to manage available resources in simple and intuitive web interface.