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:
-
The app server sends a request with the SDK token to the Interactive Whiteboard server to create a whiteboard room.
-
The Interactive Whiteboard server returns the room UUID to the app server when a room is created successfully.
-
The app server generates a room token using the returned room UUID and sends the room token and UUID to the app client.
-
The app client calls
createFastboardof the Fastboard SDK to create aFastboardAppinstance and join the interactive whiteboard room.Version 1.0.0 adds the
appliance-plugin, which implements a high-performance whiteboard drawing tool and supports use in multi-window mode. For details, see Appliance Plugin.
Prerequisites
- A web browser that meets the minimum version requirements in Supported platforms.
- A valid Agora account.
- An Agora project with the Interactive Whiteboard enabled. Get the App Identifier and SDK token from Agora Console. See Enable and configure Interactive Whiteboard.
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.
- Use code. See Generate a token from your app server. Recommended.
- Call the Interactive Whiteboard RESTful API. See Generate a room token (POST).
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 basic web application
Create a new directory named fastboard_quickstart. For a minimal web app client, create the following files in the directory:
package.jsonindex.htmlmain.js
Add dependencies
Run the following line to install the latest version of the Fastboard SDK and other dependencies:
npm add @netless/fastboard @netless/window-manager white-web-sdkCreate the user interface
In index.html, add the following code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app" style="width: 600px; height: 400px; border: 1px solid;"></div>
<script type="module" src="/main.js"></script>
</body>
</html>Join the whiteboard room
Open main.js and add the following code:
import { createFastboard, mount } from "@netless/fastboard";
let app;
async function mountFastboard(div) {
app = await createFastboard({
sdkConfig: {
appIdentifier: "Your App Identifier",
region: "cn-hz",
},
joinRoom: {
uid: "User ID",
uuid: "Room UUID",
roomToken: "Room Token",
},
managerConfig: {
cursor: true,
},
});
window.app = app;
return mount(app, div);
}
mountFastboard(document.getElementById("app"));Reference
-
To install dependencies, run
npm install. -
To run the project, run
npm run dev.Running the web app through a local server (localhost) is for testing purposes only. In production, ensure that you use the HTTPS protocol when deploying your project.
