diff --git a/application/example/data/datasource/server/restapi.mjs b/application/example/data/datasource/server/restapi.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7f4a2eb076a7a9de6f2518e653b2b33a05b79b56 --- /dev/null +++ b/application/example/data/datasource/server/restapi.mjs @@ -0,0 +1,14 @@ +import {RestAPI} from '@schukai/monster/source/data/datasource/server/restapi.mjs'; + +const ds = new RestAPI({ + write: { + url: 'https://httpbin.org/get' + }, + read: { + url: 'https://httpbin.org/get' + } +}); + +ds.set({flag: true}) +ds.write().then(() => console.log('done')); +ds.read().then(() => console.log('done')); \ No newline at end of file diff --git a/application/example/data/storage/restapi.mjs b/application/example/data/datasource/server/webconnect.mjs similarity index 50% rename from application/example/data/storage/restapi.mjs rename to application/example/data/datasource/server/webconnect.mjs index 983e632687fdd39e9159a5da0a8f5fb4b6a86285..c0c020b7d7618d1de670bc18c49d947908bc9c0d 100644 --- a/application/example/data/storage/restapi.mjs +++ b/application/example/data/datasource/server/webconnect.mjs @@ -1,9 +1,7 @@ -import {RestAPI} from '@schukai/monster/source/data/datasource/restapi.mjs'; +import {WebConnect} from '@schukai/monster/source/data/datasource/server/webconnect.mjs'; -const ds = new RestAPI({ +const ds = new WebConnect({ url: 'https://httpbin.org/get' -}, { - url: 'https://httpbin.org/post' }); ds.set({flag: true}) diff --git a/application/example/net/webconnect.mjs b/application/example/net/webconnect.mjs new file mode 100644 index 0000000000000000000000000000000000000000..94dd3c9f7744f3c44d93b067a9de769cd83f7a4c --- /dev/null +++ b/application/example/net/webconnect.mjs @@ -0,0 +1,16 @@ +import {WebConnect} from '@schukai/monster/source/net/webconnect.mjs'; + +const connection = new WebConnect({ + url: 'https://httpbin.org/get' +}); + +connection.connect().then(()=>{ + + connection.send({message:"Hello World!"}).then((response)=>{ + console.log(response); + }); + + const message = connection.poll() + + +}) diff --git a/application/source/data/datasource/server/restapi.mjs b/application/source/data/datasource/server/restapi.mjs index f54aabb1b6e0103a28015671ce91ec46bfc1fa8d..4d7065cec6034321ff95b0511fdbe33f4a8871f3 100644 --- a/application/source/data/datasource/server/restapi.mjs +++ b/application/source/data/datasource/server/restapi.mjs @@ -17,7 +17,7 @@ export {RestAPI} /** * The RestAPI is a class that enables a REST API server. * - * @externalExample ../../../example/data/storage/restapi.mjs + * @externalExample ../../../../example/data/datasource/server/restapi.mjs * @license AGPLv3 * @since 1.22.0 * @copyright schukai GmbH diff --git a/application/source/data/datasource/server/webconnect.mjs b/application/source/data/datasource/server/webconnect.mjs index cd91e8da73565279c2b38c5f755ab8b4c771fed0..07e6c4ec7dad2cdd09869be87589fd18bf46c9d1 100644 --- a/application/source/data/datasource/server/webconnect.mjs +++ b/application/source/data/datasource/server/webconnect.mjs @@ -26,7 +26,7 @@ const webConnectSymbol = Symbol("connection"); /** * The RestAPI is a class that enables a REST API server. * - * @externalExample ../../../example/data/storage/restapi.mjs + * @externalExample ../../../../example/data/datasource/server/webconnect.mjs * @license AGPLv3 * @since 3.1.0 * @copyright schukai GmbH diff --git a/application/source/net/webconnect.mjs b/application/source/net/webconnect.mjs index 48535e2b1b816a6827aa752b93f00b210e81cadd..a497ded29fd784b0cd3e35ae19216e89487c7dae 100644 --- a/application/source/net/webconnect.mjs +++ b/application/source/net/webconnect.mjs @@ -158,18 +158,18 @@ function connectServer(resolve, reject) { /** * The RestAPI is a class that enables a REST API server. * - * @externalExample ../../../example/data/storage/restapi.mjs + * @externalExample ../../example/net/webconnect.mjs * @license AGPLv3 * @since 3.1.0 * @copyright schukai GmbH - * @memberOf Monster.Data.Datasource + * @memberOf Monster.Net * @summary The LocalStorage class encapsulates the access to data objects. */ class WebConnect extends BaseWithOptions { /** * - * @param {Object} [options] options contains definitions for the datasource. + * @param {Object} [options] options contains definitions for the webconnect. */ constructor(options) { diff --git a/application/source/net/webconnect/message.mjs b/application/source/net/webconnect/message.mjs index 2df1bd5e6791b88f1169ee104fbd103f7a4cfd67..e198ed9d87528765a5b9586e105cac52e4c12b03 100644 --- a/application/source/net/webconnect/message.mjs +++ b/application/source/net/webconnect/message.mjs @@ -14,6 +14,12 @@ const dataSymbol = Symbol("@@data"); /** * This class represents a WebSocket message. + * + * @license AGPLv3 + * @since 3.4.0 + * @copyright schukai GmbH + * @memberOf Monster.Net.WebSocket + * @summary The Message class encapsulates a WebSocket message. */ class Message extends Base { diff --git a/application/source/net/webconnect/namespace.mjs b/application/source/net/webconnect/namespace.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ba98b2c10433bd62855229afdeb7fa64bc54f6c0 --- /dev/null +++ b/application/source/net/webconnect/namespace.mjs @@ -0,0 +1,15 @@ +/** + * Copyright 2022 schukai GmbH + * SPDX-License-Identifier: AGPL-3.0 + */ + + + +/** + * In this namespace you will find classes and methods for handling data. + * + * @namespace Monster.Net.WebConnect + * @memberOf Monster.Net + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file