UNPKG

zby-live-sdk

Version:

This is a live SDK for weclassroom.

52 lines (43 loc) 1.41 kB
import { GateClient, ChatClient } from './base'; import Protocol from 'pomelo-protocol'; import Protobuf from 'pomelo-protobuf'; import LatestQueue from './latestQueue.js'; import util from './util'; import CHANNEL from '../index'; import defaultApi from '../../default/extend'; import dataReport from '../../network/dataReport'; import { pomeloBackupDomains } from '../../config/config.js'; class PomeloClient { constructor() { this.gateClient = new GateClient(); this.chatClient = new ChatClient(); this.reqId = 0; this.callBacks = {}; this.handlers = {}; this.routeMap = {}; } async joinRoom(pomeloConfig) { this.isInRoom = true; this.log(`channel_log :${JSON.stringify(pomeloConfig)} the first step to join pomelo ......`); try { dataReport.pomeloJoinRoom({pomeloConfig}); } catch (e) { this.log(`pomeloJoinRoom error ${JSON.stringify(e)}`); } await this.gateClient.connectServer(pomeloConfig); const chatConfig = this.gateClient.requestChatConfig(); await this.chatClient.connectServer(chatConfig); } initPomeloData(data) { if (!data || !data.sys) { return; } const dict = data.sys.dict; const protos = data.sys.protos; if (dict) {} } log(msg) { defaultApi.writeLog(msg, 'channel-pomelo'); } } export default new PomeloClient();