Netless

Netless

  • JavaScript
  • Android
  • iOS
  • Server
  • FAQ
  • GitHub
  • 🇨🇳 中文

›Quick start

Document structure

  • Outline

Installation guide

  • SDK install
  • Version history
  • Open source
  • Debug

Quick start

  • Precondition
  • Room authentication
  • Real-time room
  • replay

Initialization

  • SDK parameters
  • Room parameters
  • Replay parameters

Features

  • Tools
  • Perspective operation
  • Page (scene) management
  • Status listen
  • Whiteboard operation
  • Custom event
  • Cursor position sync
  • Document conversion
  • Replay
  • Big class read-only
  • Plugins

Upgrade

  • SDK v2 migration

Room authentication

Safety instructions

The operations performed in this section should be performed in the developer business server. The request can be found at Whiteboard basic API.

To create a room / get a room, you need to use sdkToken to interact with theSDK backend server. sdkToken is a credential for theSDK back-end server to communicate with the developer's back-end business server. After mastering sdkToken, theSDK backend server will think that this is an operation performed by the developer. It mainly involves developers' billing and rights management for corresponding resources.

In this chapter, for the convenience of demonstration, the operation of creating a room /getting a specific roomroomToken is written on the front end. In actual business, in order to prevent someone from decompiling client code or capturing packages and obtaining SDKToken, please do not exposesdkToken on any client.

Create new room and get roomToken

This network request creates a room API for the server, more details can be viewedWhiteboard basic API

var sdkToken = "Read [Prerequisites] to get token";
var url = 'https://cloudcapiv4.herewhite.com/room?token=' + sdkToken;
var requestInit = {
    method: 'POST',
    headers: {
        "content-type": "application/json",
    },
    body: JSON.stringify({
        name: "room name",
        limit: 0, // Limit on the number of rooms
        mode: "persistent",  // Normal room, unable to play back
        // mode: "historied", // Playback room
    }),
};

// Request to create a room and get sdk backend server response
fetch(url, requestInit).then(function(response) {
    return response.json();
}).then(function(json) {
    console.log(json);
}).catch(function(err) {
    console.error(err);
});

Get RoomToken for a specific room

This network request is for the server to obtain a specific whiteboard roomToken API, more details can be viewed Whiteboard basic API

var sdkToken = "Read the [Prerequisites] document to get the token";
var uuid = "Read from the business server or URL";
// Note that the path to the room is room / join and the room is created as room
var url = `https://cloudcapiv4.herewhite.com/room/join?token=${sdkToken}&uuid=${uuid}`;
var requestInit = {
    method: 'POST',
    headers: {
        "content-type": "application/json",
    },
};

fetch(url, requestInit).then(function(response) {
    return response.json();
}).then(function(json) {
    console.log(json);
}).catch(function(err) {
    console.error(err);
});
Last updated on 2/21/2020 by 伍双
← PreconditionReal-time room →
  • Safety instructions
  • Create new room and get roomToken
  • Get RoomToken for a specific room
Netless
Let's interactive.
Product
ConsoleHomepageDemoGithub
Company
Join usServicePrivacy
Contact
support@netless.linkCommunity
Copyright © 2020 Netless