Netless

Netless

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

›Features

Overview

  • Introduction
  • Open source
  • Version history

Quick start

  • Overview
  • Client integration
  • Initialization
  • Create Room
  • Join room

Features

  • Doc-conversion & replay
  • State management
  • Tools
  • Perspective operation
  • Whiteboard operation
  • Custom event
  • Scene management
  • Big class read-only
  • Replay

Upgrade

  • 2.0 v2migration

Big class read-only

1. Why enable read-only

Increase the maximum number of people that can be carried in a room and reduce the cost of subscribing to a long connection. (sdk upgrade to latest support)

Detailed description of read-only mode and interactive mode

2. How to enable read-only

2.1 Enable read-only before joining (recommended)

     public class RoomParams extends WhiteObject {

     public void setWritable(boolean writable) {
          isWritable = writable;
     }
}

2.2 Open (or close) read-only after joining

     public class Room extends Displayer {

    /**
     * Set read-write mode
     * @param writable is writable
     * @param promise completes the callback and returns the read and write status of the room at the same time
     * @since 2.6.1
     */
    public void setWritable(final boolean writable, final Promise<Boolean> promise) {
        bridge.callHandler("room.setWritable", new Object[]{writable}, new OnReturnValue<String>() {
            @Override
            public void onValue(String result) {
                SDKError sdkError = SDKError.promiseError(result);
                if (sdkError != null) {
                    promise.catchEx(sdkError);
                } else {
                    JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
                    Boolean isWritable = jsonObject.get("isWritable").getAsBoolean();
                    setWritable(isWritable);
                    promise.then(isWritable);
                }
            }
        });
    }
}
Last updated on 2/24/2020 by 伍双
← Scene managementReplay →
  • 1. Why enable read-only
  • 2. How to enable read-only
    • 2.1 Enable read-only before joining (recommended)
    • 2.2 Open (or close) read-only after joining
Netless
Let's interactive.
Product
ConsoleHomepageDemoGithub
Company
Join usServicePrivacy
Contact
support@netless.linkCommunity
Copyright © 2020 Netless