{"size": 927, "ext": "js", "max_stars_repo_path": "examples/loadbalancer/loadbalancer.js", "max_stars_repo_name": "coderofsalvation/ezrpc", "max_stars_repo_stars_event_min_datetime": "2020-03-27T22:48:56.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-13T14:10:19.000Z", "max_issues_repo_path": "examples/loadbalancer/loadbalancer.js", "max_issues_repo_name": "coderofsalvation/ezrpc", "max_issues_repo_issues_event_min_datetime": "2020-03-27T14:52:26.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-16T15:22:57.000Z", "max_forks_repo_path": "examples/loadbalancer/loadbalancer.js", "max_forks_repo_name": "coderofsalvation/ezrpc", "max_forks_repo_forks_event_min_datetime": "2020-03-29T18:08:46.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-16T07:57:59.000Z"}
{"max_stars_count": 3, "max_issues_count": 14, "max_forks_count": 2, "avg_line_length": 34.3333333333, "max_line_length": 92, "alphanum_fraction": 0.736785329}
const { LoadBalancer } = require('../../')

// Lets define what servers we want to load balance for
const serversToLoadBalance = [{
  host: 'localhost',
  port: 1251
}]
// In a real-world scenario you would of course have multiple servers in here

// Start a load balancer server on port 1250
// This server acts just like a normal ezrpc Server, but will relay any undefined methods to
// servers in serversToLoadBalance
const server = new LoadBalancer(serversToLoadBalance, 1250)

// Your load balancer is already set up now!
// The function call to myMethod in client.js will be relayed
// to the server that was defined in server.js (running on localhost:1251) 

// Exporting modules (as shown below) is completely optional
// If you do export methods, however, they will not be relayed
// to a server in serversToLoadBalance but will be executed by
// the load balancer itself
//
// server.module.exports = {
//   ...
// }
