Netless

Netless

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

›Features

Overview

  • Introduction
  • Open source
  • Version history

Quick start

  • Overview
  • Client integration
  • Init SDK
  • Create Room
  • Join room
  • Callback and lifecycle

Features

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

Upgrade

  • 2.0 v2migration

Custom event

During the use of the developer, there are likely to be other diverse requirements. The SDK also provides some custom interfaces for developers to implement. You can simply compare this function to the iOS Notification Center NSNotificationCenter. The custom event API is similar to the notification center.

Register, remove, send custom events

Real-time room

@interface WhiteRoom : NSObject

// Register custom eventName
- (void) addMagixEventListener: (NSString *) eventName;
/**
    eventName event name sent
    Payload data attached to the event
 */
- (void) dispatchMagixEvent: (NSString *) eventName payload: (NSDictionary *) payload;
// Remove the custom event listener for eventName
- (void) removeMagixEventListener: (NSString *) eventName;
@end

Playback Room

New in version 2.0.4

@interface WhitePlayer : NSObject

// Register custom eventName
- (void) addMagixEventListener: (NSString *) eventName;
// Remove the custom event listener for eventName
- (void) removeMagixEventListener: (NSString *) eventName;

@end

Custom event callback

Real-time room

When a registered custom event is triggered, the SDK will call back an instance that implements the WhiteRoomCallbackDelegate protocol when a WhiteRoom instance is created using WhiteSDK. which is

@interface WhiteSDK : NSObject
- (instancetype)initWithBoardView:(WhiteBoardView *)boardView config:(WhiteSdkConfiguration *)config callbackDelegate:(id<WhiteRoomCallbackDelegate>)callbackDelegate
@end

CallbackDelegate parameter.

When a user sends a custom event with the corresponding name in the room, the SDK will callback the method of WhiteRoomCallbackDelegate:

@protocol WhiteRoomCallbackDelegate <NSObject>
@optional
// Custom event callback event
- (void)fireMagixEvent:(WhiteEvent *)event;
@end

Playback Room

New in version 2.0.4

Similar to a real-time room, when a custom event occurs during playback, the SDK will call back when the WhitePlayer instance is created in WhiteSDK, and an instance that implements the WhitePlayerEventDelegate protocol is passed in. which is

@interface WhiteSDK : NSObject
- (void)createReplayerWithConfig:(WhitePlayerConfig *)config callbacks:(nullable id<WhitePlayerEventDelegate>)eventCallbacks completionHandler:(void (^) (BOOL success, WhitePlayer * _Nullable player, NSError * _Nullable error))completionHandler;
@end

When a user sends a custom event with the corresponding name during playback, the SDK will call back the method of WhiteRoomCallbackDelegate:

@protocol WhitePlayerEventDelegate <NSObject>
@optional
/**
Whiteboard custom event callback,
 */
- (void)fireMagixEvent:(WhiteEvent *)event;
@end
Last updated on 1/14/2020 by 伍双
← Whiteboard operationScene management →
  • Register, remove, send custom events
    • Real-time room
    • Playback Room
  • Custom event callback
    • Real-time room
    • Playback Room
Netless
Let's interactive.
Product
ConsoleHomepageDemoGithub
Company
Join usServicePrivacy
Contact
support@netless.linkCommunity
Copyright © 2020 Netless