set method

ServerIO set(
  1. String key, [
  2. dynamic val
])

Backwards compatibility.

Implementation

ServerIO set(String key, [val]) {
  if ('authorization' == key && val != null) {
    use((socket, next) {
      val(socket.request, (err, authorized) {
        if (err) {
          return next(Exception(err));
        }

        if (!authorized) {
          return next(Exception('Not authorized'));
        }

        next();
      });
    });
  } else if ('origins' == key && val != null) {
    origins(val);
  } else if ('resource' == key) {
    path(val);
  } else if (oldSettings[key] && engine![oldSettings[key]]) {
    engine![oldSettings[key]] = val;
  }

  return this;
}