Session constructor
Implementation
Session(this.gatewayCallbacks) {
this.server =
gatewayCallbacks.server != null ? gatewayCallbacks.server : null;
this.iceServers = gatewayCallbacks.iceServers != null
? gatewayCallbacks.iceServers
: this.iceServers;
this.iceTransportPolicy = gatewayCallbacks.iceTransportPolicy != null
? gatewayCallbacks.iceTransportPolicy
: null;
this.bundlePolicy = gatewayCallbacks.bundlePolicy != null
? gatewayCallbacks.bundlePolicy
: null;
this.ipv6Support = gatewayCallbacks.ipv6Support != null
? gatewayCallbacks.ipv6Support
: null;
this.withCredentials = gatewayCallbacks.withCredentials != null
? gatewayCallbacks.withCredentials
: null;
this.maxPollEvents = gatewayCallbacks.maxPollEvents != null
? gatewayCallbacks.maxPollEvents
: this.maxPollEvents;
this.token = gatewayCallbacks.token != null ? gatewayCallbacks.token : null;
this.apiSecret =
gatewayCallbacks.apiSecret != null ? gatewayCallbacks.apiSecret : null;
this.destroyOnUnload = gatewayCallbacks.destroyOnUnload != null
? gatewayCallbacks.destroyOnUnload
: this.destroyOnUnload;
this.keepAlivePeriod = gatewayCallbacks.keepAlivePeriod != null
? gatewayCallbacks.keepAlivePeriod
: null;
this.longPollTimeout = gatewayCallbacks.longPollTimeout != null
? gatewayCallbacks.longPollTimeout
: null;
if (!Janus.initDone) {
if (gatewayCallbacks.error is Function)
gatewayCallbacks.error("Plugin not initialized");
return;
}
Janus.log("Plugin initialized: " + Janus.initDone.toString());
if (gatewayCallbacks.server == null) {
gatewayCallbacks.error("Invalid server url");
return;
}
if (Janus.isArray(this.server)) {
Janus.log("Multiple servers provided (" +
this.server.length +
"), will use the first that works");
this.servers = this.server;
this.server = null;
}
if (this.server.indexOf("ws") == 0) {
this.websockets = true;
Janus.log("Using WebSockets to contact Janus: " + this.server);
} else {
Janus.log("Using REST API to contact Janus: " + server);
}
if (this.maxPollEvents != null && this.maxPollEvents > 1)
this.maxev = this.maxPollEvents;
else
this.maxev = 1;
createSession(callbacks: gatewayCallbacks);
}