# Trouble sending commands

**URL:** <https://devforum.zoom.us/t/trouble-sending-commands/108396>\
**Category:** Video SDK\
**Created:** [April 22, 2024, 9:50am UTC](https://devforum.zoom.us/t/trouble-sending-commands/108396 "2024-04-22T09:50:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 22, 2024, 9:50am UTC](https://devforum.zoom.us/t/trouble-sending-commands/108396/1 "2024-04-22T09:50:17Z")

</div>

**Video SDK Type and Version**  
1.10.8 for Web

**Description**  
Attempting to send command like below-

```auto
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**

```auto
@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.

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 22, 2024, 9:52am UTC](https://devforum.zoom.us/t/trouble-sending-commands/108396/2 "2024-04-22T09:52:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 22, 2024, 9:56am UTC](https://devforum.zoom.us/t/trouble-sending-commands/108396/3 "2024-04-22T09:56:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [April 22, 2024, 10:11am UTC](https://devforum.zoom.us/t/trouble-sending-commands/108396/4 "2024-04-22T10:11:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 22, 2024, 10:27am UTC](https://devforum.zoom.us/t/trouble-sending-commands/108396/5 "2024-04-22T10:27:25Z")

</div>

Worked. Thanks, Vic.
