<commit_before># Server-side
- run the server on specified port
	rt = new Router(8080)
- start/stop the router
	rt.start();
	rt.stop();
- have access to all logged clients
	rt.getClients(); // {ip:port,id} list
- register a callback to the clients list update
	rt.on('newclient', fn(clientid));
	rt.on('leaveclient', fn(clientid));
	rt.on('listupdate', fn(clientid));
	//...
- get a client socket
	rt.getClientSocket(id or ip:port);
- broadcast to all clients
	rt.broadcast(message);
- a way to send to a client
	rt.send("ip:port", message);

# Client-side
- open a connection
	con = new Connection("server.com:port");
- send a message 
	con.send(message);
- receive messages
	con.listen(fn(message));

# Protocol spec.
	message = { dst : "ip:port",
					src : "ip:port",  //added by the server
					msg : 	....
				 };<commit_msg>add Api idea<commit_after># Server-side
- run the server on specified port
```js
rt = new Router(8080)
```
- start/stop the router
```js
	rt.start();
	rt.stop();
```
- have access to all logged clients
```js
rt.getClients(); // {ip:port,id} list
```
- register a callback to the clients list update
```js
	rt.on('newclient', fn(clientid));
	rt.on('leaveclient', fn(clientid));
	rt.on('listupdate', fn(clientid));
	//...
```
- get a client socket
```js
	rt.getClientSocket(id or ip:port);
```
- broadcast to all clients
```js
	rt.broadcast(message);
```
- a way to send to a client
```js
	rt.send("ip:port", message);
```

# Client-side
- open a connection
```js
	con = new Connection("server.<EMAIL>:port");
```
- send a message 
```js
	con.send(message);
```
- receive messages
```js
	con.listen(fn(message));
```

# Protocol spec.
```js
	message = { dst : "ip:port",
					src : "ip:port",  //added by the server
					msg : 	....
				 };
```
{'fraction_non_alphanumeric': 0.18386914833615342, 'fraction_numerical': 0.0045121263395375075, 'mean_word_length': 3.5839793281653747, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3894675', 'n_tokens_mistral': 669, 'n_tokens_neox': 616, 'n_words': 185}