Some minor improvements
This commit is contained in:
@@ -56,7 +56,7 @@ connection.callback_disconnect = reason => {
|
||||
console.log("Got disconnect: %s", reason);
|
||||
};
|
||||
|
||||
const do_connect = () => {
|
||||
const do_connect = (connection) => {
|
||||
connection.connect({
|
||||
timeout: 5000,
|
||||
remote_port: 9987,
|
||||
@@ -150,7 +150,16 @@ const do_connect = () => {
|
||||
|
||||
connection._voice_connection.register_client(7);
|
||||
};
|
||||
do_connect();
|
||||
do_connect(connection);
|
||||
let _connections = [];
|
||||
let i = 0;
|
||||
let ii = setInterval(() => {
|
||||
if(i++ > 35)
|
||||
clearInterval(ii);
|
||||
const c = handle.spawn_server_connection();
|
||||
_connections.push(c);
|
||||
do_connect(c);
|
||||
}, 500);
|
||||
|
||||
connection.callback_voice_data = (buffer, client_id, codec_id, flag_head, packet_id) => {
|
||||
console.log("Received voice of length %d from client %d in codec %d (Head: %o | ID: %d)", buffer.byteLength, client_id, codec_id, flag_head, packet_id);
|
||||
@@ -167,6 +176,7 @@ setInterval(() => {
|
||||
/* keep the object alive */
|
||||
setTimeout(() => {
|
||||
connection.connected();
|
||||
_connections.forEach(e => e.current_ping());
|
||||
}, 1000);
|
||||
|
||||
connection_list.push(connection);
|
||||
Reference in New Issue
Block a user