0.0.1 • Published 5 years ago

drachtio-fn-get-least-loaded-ms v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

drachtio-fn-fsmrf-sugar

Utility functions for drachtio-fsmrf

loadbalancer

Function to return the least-loaded media server

const {loadbalancer} = require('drachtio-fn-fsmrf-sugar');

/*
  servers = [
  {
    address: '10.100.0.1', 
    port: 8021, 
    secret: 'ClueCon'
  },
  {
    address: '10.100.0.2', 
    port: 8021, 
    secret: 'ClueCon'
  }]
*/
// call this once to connect to the array of media servers
const getLeastLoaded = loadbalancer({
  servers, mrf
});

// then call this repeatedly to the current least loaded media server
const ms = getLeastLoaded();