@eclipse-ditto/ditto-javascript-client-node
Version:
Node.js(r) implementation of Eclipse Ditto JavaScript API.
47 lines • 2.07 kB
JavaScript
;
/*!
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DittoNodeClient = void 0;
const http_client_builder_1 = require("../../api/src/client/http-client-builder");
const websocket_client_builder_1 = require("../../api/src/client/websocket-client-builder");
const node_http_1 = require("./node-http");
const node_websocket_1 = require("./node-websocket");
const proxy_settings_1 = require("./proxy-settings");
/**
* Starting point to build clients that can be used to get handles for NodeJS.
*/
class DittoNodeClient {
/**
* Returns a mutable builder with a fluent API for creating a Http-Ditto-Client.
* The returned builder utilizes *Object scoping* to guide you through the building process.
*
* @param proxyOptions - Options to establish a proxy connection.
* @return the builder.
*/
static newHttpClient(proxyOptions) {
return http_client_builder_1.HttpClientBuilder.newBuilder(new node_http_1.NodeRequester(new proxy_settings_1.ProxyAgent(proxyOptions)));
}
/**
* Returns a mutable builder with a fluent API for creating a Web-Socket-Ditto-Client.
* The returned builder utilizes *Object scoping* to guide you through the building process.
*
* @param proxyOptions - Options to establish a proxy connection.
* @return the builder.
*/
static newWebSocketClient(proxyOptions) {
return websocket_client_builder_1.WebSocketClientBuilder.newBuilder(new node_websocket_1.NodeWebSocketBuilder(new proxy_settings_1.ProxyAgent(proxyOptions)));
}
}
exports.DittoNodeClient = DittoNodeClient;
//# sourceMappingURL=ditto-node-client.js.map