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

Custom event

You can use custom events to meet scenarios such as IM, barrage, and like.

Room, Player (2.0.0-beta15) both support custom events. Player cannot send custom events, but supports adding and removing listeners.

Register and remove custom event listeners


public void addMagixEventListener(String eventName, EventListener eventListener) ;
public void removeMagixEventListener(String eventName) ;

addMagixEventListener andremoveMagixEventListener are used to register and remove custom event listeners, and eventName is the message type name. EventListener is handled when a custom event is received.

Sending Custom Events (Room only)


public void dispatchMagixEvent(AkkoEvent eventEntry);

dispatchMagixEvent is used to send AkkoEvent. AkkoEvent structure is as follows:

  • payload is any JSON serializable object
  • eventName is the name of the message type. Everyone in the same room will receive a message of the same type in the room.
public class AkkoEvent {
    private String eventName;
    private Object payload;

    public AkkoEvent(String eventName, Object payload) {
        this.eventName = eventName;
        this.payload = payload;
    }
}
Last updated on 1/14/2020 by 伍双
← Whiteboard operationScene management →
  • Register and remove custom event listeners
  • Sending Custom Events (Room only)
Netless
Let's interactive.
Product
ConsoleHomepageDemoGithub
Company
Join usServicePrivacy
Contact
support@netless.linkCommunity
Copyright © 2020 Netless