lib/rpc-client/router.js
function defRoute(session, msg, context, cb) {
    const list = context.getServersByType(msg.serverType);
    if (!list || !list.length) {
        cb(new Error(`can not find server info for type:${msg.serverType}`));
        return;
    }
    const uid = session ? (session.uid || '') : '';
    const index = Math.abs(crc.crc32(uid.toString())) % list.length;
    utils.invokeCallback(cb, null, list[index].id);
}
function defRoute(session, msg, context, cb) {
    const list = context.getServersByType(msg.serverType);
    if (!list || !list.length) {
        cb(new Error(`can not find server info for type:${msg.serverType}`));
        return;
    }
    const uid = session ? (session.uid || '') : '';
    const index = Math.abs(crc.crc32(uid.toString())) % list.length;
    utils.invokeCallback(cb, null, list[index].id);
}
function defRoute ( session , msg , context , cb ) { const list = context . getServersByType ( msg . serverType ) ; if ( ! list || ! list . length ) { cb ( new Error ( ` ${ msg . serverType } ` ) ) ; return ; } const uid = session ? ( session . uid || '' ) : '' ; const index = Math . abs ( crc . crc32 ( uid . toString ( ) ) ) % list . length ; utils . invokeCallback ( cb , null , list [ index ] . id ) ; }
Calculate route info and return an appropriate server id.

@param session {Object} session object for current rpc request
@param msg {Object} rpc message. {serverType, service, method, args, opts}
@param context {Object} context of client
@param cb(err, serverId)
Calculate route info and return an appropriate server id .