var Stormancer;
(function (Stormancer) {
var Configuration = (function () {
/**
Creates a Configuration. Prefer the **Configuration.forAccount** method instead of this constructor.
@class Configuration
@classdesc Represents the configuration of a Stormancer client. Use the static method **Configuration.forAccount** for creating a Configuration with an account ID and an application name.
@memberof Stormancer
*/
function Configuration() {
/**
A string containing the target server endpoint.
This value overrides the *apiEndpoint* property.
@member Stormancer.Configuration#serverEndpoint
@type {string}
*/
this.serverEndpoint = "";
/**
A string containing the account name of the application.
@member Stormancer.Configuration#account
@type {string}
*/
this.account = "";
/**
A string containing the name of the application.
@member Stormancer.Configuration#application
@type {string}
*/
this.application = "";
/**
The plugins list
*/
this.plugins = [];
/**
The metadatas to send for connexion
*/
this.metadata = {};
/**
Gets or Sets the dispatcher to be used by the client.
@member Stormancer.Configuration#dispatcher
@type {object}
*/
this.dispatcher = null;
/**
Gets or sets the transport to be used by the client.
@member Stormancer.Configuration#transport
@type {object}
*/
this.transport = null;
/**
List of available serializers for the client.
When negotiating which serializer should be used for a given remote peer, the first compatible serializer in the list is the one prefered.
@member Stormancer.Configuration#serializers
@type {object[]}
*/
this.serializers = [];
this.transport = new Stormancer.WebSocketTransport();
this.dispatcher = new Stormancer.DefaultPacketDispatcher();
this.serializers = [];
this.serializers.push(new Stormancer.MsgPackSerializer());
this.plugins.push(new Stormancer.RpcClientPlugin());
}
/**
Creates a Configuration object targeting the public online platform.
@method Stormancer.Configuration#forAccount
@param {string} accountId Account ID
@param {string} applicationName Application name
@return {Stormancer.Configuration} The configuration object
*/
Configuration.forAccount = function (accountId, applicationName) {
var config = new Configuration();
config.account = accountId;
config.application = applicationName;
return config;
};
/**
Returns the API Endpoint URI to use.
@return {string} API Endpoint URI
*/
Configuration.prototype.getApiEndpoint = function () {
return this.serverEndpoint ? this.serverEndpoint : Configuration.apiEndpoint;
};
/**
Adds metadata to the connection.
@param {string} key
@param {string} value
@return {Configuration} this
*/
Configuration.prototype.Metadata = function (key, value) {
this.metadata[key] = value;
return this;
};
/**
API Endpoint URI
*/
Configuration.apiEndpoint = "https://api.stormancer.com/";
return Configuration;
})();
Stormancer.Configuration = Configuration;
})(Stormancer || (Stormancer = {}));
//# sourceMappingURL=Configuration.js.map