Home Reference Source
import SignalerBase from 'rtc-engine/js/signaler/Base.js'
public class | source

SignalerBase

Extends:

Mitt → SignalerBase

Direct Subclass:

LocalSignaler

시그널러에 필수적인 기능들을 제공하는 베이스 클래스. 시그널러는 반드시 이 클래스를 확장해야 합니다.

다음과 같은 기능들을 제공합니다:

  • 받은 메시지의 type 에 해당하는 이벤트를 발생시켜서 메시지를 전달합니다. 이렇게 하면 하나의 이벤트를 발생시키는것보다 효율적으로 코드를 구현할 수 있습니다.
  • type 이벤트의 핸들러가 없을 경우 핸들러가 추가될때까지 기다렸다가 추가되면 그 핸들러가 전에 받았던 메시지를 모두 처리하도록 합니다. 이렇게 하면 시그널러가 엔진이 생성되기전에 메시지를 받아도 메시지가 정상적으로 엔진에 전달됩니다.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

options: {}

RTCEngine 생성시 적용될 설정값들.

public

ready: *

시그널러가 메시지를 보낼 수 있는 상태인지 나타내는 값.

public

받은 메시지의 type 필드에 해당하는 이벤트 리스너가 없으면 여기에 보관됩니다.

Method Summary

Public Methods
public abstract

close(engine: RTCEngine)

public abstract

connected(engine: RTCEngine)

public abstract

disconnected(engine: RTCEngine)

public abstract

failed(engine: RTCEngine)

public

on(type: string, handler: EventHandler<object>)

특정 type의 메시지에 대한 핸들러를 등록합니다.

public

receive(msg: *)

메시지를 엔진에 전달합니다.

public abstract

send(data: *)

public abstract

start(engine: RTCEngine)

Inherited Summary

From class Mitt
public

all: Map<string|symbol, EventHandler<any>[]>

이벤트별 이벤트 핸들러들

public

addEventListener(type: string | symbol, handler: EventHandler<any>): *

on() 메소드의 alias

public

emit(type: string | symbol, evt: Any)

Invoke all handlers for the given type.

public

off(type: string | symbol, handler: EventHandler<any>})

Remove an event handler for the given type.

public

on(type: string | symbol, handler: EventHandler<any>): *

Register an event handler for the given type.

public

once(type: *, handler: *)

public

removeEventListener(type: string | symbol, handler: EventHandler<any>): *

off() 메소드의 alias

Public Constructors

public constructor() source

Override:

Mitt#constructor

Public Members

public options: {} source

RTCEngine 생성시 적용될 설정값들. 유저 설정값에 의해서 덮어써질 수 있습니다.

public ready: * source

시그널러가 메시지를 보낼 수 있는 상태인지 나타내는 값. RTCEngine은 시그널러와 상호작용할 때 항상 이 값이 true가 될때까지 기다립니다.

public unhandledMsg: Map<string, any[]> source

받은 메시지의 type 필드에 해당하는 이벤트 리스너가 없으면 여기에 보관됩니다.

Public Methods

public abstract close(engine: RTCEngine) source

Params:

NameTypeAttributeDescription
engine RTCEngine

엔진 인스턴스

public abstract connected(engine: RTCEngine) source

Params:

NameTypeAttributeDescription
engine RTCEngine

엔진 인스턴스

public abstract disconnected(engine: RTCEngine) source

Params:

NameTypeAttributeDescription
engine RTCEngine

엔진 인스턴스

public abstract failed(engine: RTCEngine) source

Params:

NameTypeAttributeDescription
engine RTCEngine

엔진 인스턴스

public on(type: string, handler: EventHandler<object>) source

특정 type의 메시지에 대한 핸들러를 등록합니다.

Override:

Mitt#on

Params:

NameTypeAttributeDescription
type string

받을 메시지의 타입

handler EventHandler<object>

메시지의 핸들러

public receive(msg: *) source

메시지를 엔진에 전달합니다.

Params:

NameTypeAttributeDescription
msg *

받은 메시지

public abstract send(data: *) source

Params:

NameTypeAttributeDescription
data *

전송할 데이터

public abstract start(engine: RTCEngine) source

Params:

NameTypeAttributeDescription
engine RTCEngine

엔진 인스턴스