sono.land

grab

grab

Allows users to grab data

Grab gives users the ability to obtain specific information. It permits the users to attain multiple data such as a list of all clientsID connected to the server, to a list of all existing channels, to the list of channels the user is in, and the clients own unique id.

1// this example allows the user to get its own unique ID
2document.getElementById('search').addEventListener('click', () => {
3 const myID = document.getELementbyId('myid').value;
4 sono.grab('myid');
5});
6
7// this example allows the user to get a list of all the clients ID connected to the websocket server
8document.getElementById('search').addEventListener('click', () => {
9 const clients = document.getELementbyId('clients').value;
10 sono.grab('clients');
11});
12
13// this example allows the user to get a list of all active channels
14document.getElementById('search').addEventListener('click', () => {
15 const channels = document.getELementbyId('channels').value;
16 sono.grab('channels');
17});
18
19// this example allows the user to get a list of all clients ID connected in the users channel
20document.getElementById('search').addEventListener('click', () => {
21 const mychannelclients = document.getELementbyId('mychannelclients').value;
22 sono.grab('mychannelclients');
23});
Edit this page on GitHub