Trouble sending commands

Video SDK Type and Version
1.10.8 for Web

Description
Attempting to send command like below-

export default class Zoom {
	static #instance;
	constructor() {
		if (Zoom.#instance) {
			throw new Error(
				'Zoom singleton instance already exists. Use getInstance() method to access it.'
			);
		}

		this.client = ZoomVideo.createClient();
		this.commandChannel = this.client.getCommandClient();
		this.stream = undefined;
		this.localVideoTrack = undefined;
		this.localAudioTrack = undefined;
		this.localMicrophoneTester = undefined;
	}

	sendCommandToAll = async (text) => {
		console.log('====>>>', {
			commandChannel: this.commandChannel
		});
	
		await this.commandChannel.send('test');
	};
	
	onToggleMic() {
		await this.sendCommandToAll(MeetingCommand.superHostMicOff);
	}
}

this.client.on('command-channel-status', (payload) => {
			console.log('======>>>>>', payload);
});

Error

@zoom_videosdk.js?v=0d7a067b:18082 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'send')
    at e6.value (@zoom_videosdk.js?v=0d7a067b:18082:21)
    at Zoom.sendCommandToAll (Zoom.js:76:29)

Troubleshooting Routes

  1. this.commandChannel is not undefined (it is a Symbol).
  2. Command channel status is coming as “Connected”
    Still I am getting above error.
1 Like

@vic.yang please see if you can help here.

Hi @chunsiong.zoom , please see if you can help here.

Hey @harshit.bhatt

Could you attempt calling client.getCommandClient() after the client.init method instead of at the very beginning of the code?

Thanks
Vic

Worked. Thanks, Vic.