Fastboard quickstart

Updated

Build a basic Interactive Whiteboard app with the Fastboard SDK.

The Fastboard SDK is the latest generation of the Whiteboard SDK launched by Agora to help developers quickly build whiteboard applications. The Fastboard SDK simplifies the APIs of the Whiteboard SDK and adds UI implementations. These improvements enable you to join a room with just a few lines of code and instantly experience real-time interactive collaboration using a variety of rich editing tools. In addition, the Fastboard SDK integrates window-manager and extensions from netless-app, which allows developers to easily extend the functionality of their whiteboard applications and enrich their users' collaboration experience.

This page explains how to quickly join a whiteboard room and experience the interactive whiteboard features using the Fastboard SDK.

Understand the tech

The following figure shows the workflow to join a whiteboard room:

Interactive Whiteboard room joining workflow

When an app client requests to join an Interactive Whiteboard room, the app client and your app server interact with the Interactive Whiteboard server in the following steps:

  1. The app server sends a request with the SDK token to the Interactive Whiteboard server to create a whiteboard room.
  2. The Interactive Whiteboard server returns the room UUID to the app server when a room is created successfully.
  3. The app server generates a room token using the returned room UUID and sends the room token and UUID to the app client.
  4. The app client calls createFastRoom and join of the Fastboard SDK to create a FastRoom instance and join the interactive whiteboard room.

Prerequisites

Project setup

Before an app client can join an interactive whiteboard room, your app server needs to call the Agora RESTful APIs to create a room, get the room UUID, generate a room token, and pass the room UUID and room token to the app client.

Create a whiteboard room

Call /v5/rooms (POST) on your app server to create a room.

var request = require("request");
var options = {
    "method": "POST",
    "url": "https://api.netless.link/v5/rooms",
    "headers": {
    "token": "Your SDK Token",
    "Content-Type": "application/json",
    "region": "us-sv"
    },
    body: JSON.stringify({
        "isRecord": false
    })
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});

Generate a room token

After creating a room and getting the uuid of the room, your app server needs to generate a room token and send it to the app client.

var request = require('request');
var options = {
    "method": "POST",
    "url": "https://api.netless.link/v5/tokens/rooms/<Room UUID>",
    "headers": {
    "token": "Your SDK Token",
    "Content-Type": "application/json",
    "region": "us-sv"
    },
    body: JSON.stringify({"lifespan":3600000,"role":"admin"})

};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});

Create a project in Xcode

  1. Open Xcode and click Create a new Xcode project.
  2. Select iOS, then Single-View Application.
  3. Fill in the project information:
    • Product Name: ExampleFastboard
    • Interface: Storyboard
    • Language: Swift
  4. Select the storage directory for your project and click Create.

Get the Fastboard SDK

  1. In Terminal, go to the directory of your Xcode project and run:

    pod init
  2. Add the following lines to the Podfile:

    platform :ios, '10.0'
    use_frameworks!
    target 'ExampleFastboard' do
        pod 'Fastboard'
    end
  3. Run:

    pod install

Join the whiteboard room

In ViewController.swift, replace the content with the following code:

import UIKit
import Fastboard

class ViewController: UIViewController {
    var fastRoom: FastRoom!

    override func viewDidLoad() {
        super.viewDidLoad()

        let config = FastRoomConfiguration(
            appIdentifier: "The App Identifier of your whiteboard project",
            roomUUID: "The room UUID",
            roomToken: "The room Token",
            region: .US,
            userUID: "The unique identifier of a user"
        )

        let fastRoom = Fastboard.createFastRoom(withFastRoomConfig: config)
        view.addSubview(fastRoom.view)
        fastRoom.joinRoom()
        self.fastRoom = fastRoom
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        fastRoom.view.frame = view.bounds
    }
}

Reference

Build the project in Xcode and run it on a simulator or a physical mobile device. If the project runs successfully, you can see the whiteboard page and use the toolbar to write and draw on the whiteboard.