newInstance static method

Transport newInstance(
  1. String name,
  2. SocketConnect connect
)

Implementation

static Transport newInstance(String name, SocketConnect connect) {
  if ('websocket' == name) {
    return WebSocketTransport(connect);
  } else if ('polling' == name) {
    if (connect.request.uri.queryParameters.containsKey('j')) {
      return JSONPTransport(connect);
    } else {
      return XHRTransport(connect);
    }
  } else {
    throw UnsupportedError('Unknown transport $name');
  }
}