code: function init(type) {
  
      return function(params) {
          if (!params) {
              params = {};
          }
  
          var settings = {
              proxyUrl: params.proxyUrl || defaults.proxyUrl,
              channel: params.channel || defaults.channel,
              keepalive: parseFalsey(params.keepalive, defaults.keepalive),
              port: params.port || defaults.port,
              log: params.log || defaults.log,
              tcp: parseFalsey(params.tcp, defaults.tcp),
              udp4: parseFalsey(params.udp4, defaults.udp4),
              socketio: parseFalsey(params.socketio, defaults.socketio),
              onlyOneControllerPerChannel: parseFalsey(params.onlyOneControllerPerChannel, defaults.onlyOneControllerPerChannel),
              onlyOneToyPerChannel: parseFalsey(params.onlyOneToyPerChannel, defaults.onlyOneToyPerChannel),
              allowObservers: parseFalsey(params.allowObservers, defaults.allowObservers),
              deviceType: type
          };
  
          if (typeof params.log !== 'function') {
              params.log = defaults.log;
          }
  
          switch (type) {
  
              case 'proxy':
                  if (isBrowser()) {
                      console.error('Cannot create proxy in browser');
                  }
                  var Proxy = require('./src/Proxy');
                  return new Proxy(settings);
  
              case 'toy':
              case 'controller':
              case 'observer':
                  var connectionModule;
                  if (isBrowser()) {
                      connectionModule = require('./src/WebClientConnection');
                      settings.udp4 = false;
                      settings.tcp = false;
                      settings.socketio = true;
                  } else {
                      connectionModule = require('./src/ClientConnection');
                      settings.socketio = false;
                  }
                  var Device = require('./src/Device');
                  return new Device(settings, connectionModule);
  
              default:
                  throw new Error('Could not determine server type.');
          }
  
      };
  }
docs: Helper function to create an initialised device or proxy server.
  @param  {string} type 'proxy', 'toy', or 'controller'.
  @return {function}    The initialisation function that can be called later.