From 9003905e11b6d2435ddece461a7ab8ddff4e904a Mon Sep 17 00:00:00 2001 From: Ali Date: Tue, 7 May 2024 11:24:35 +0330 Subject: [PATCH 1/3] finalize --- .vscode/launch.json | 2 +- Models/Connection/ConnectionInfo.js | 4 +- Models/Connection/SocketConnectionInfo.js | 59 ++++++++++++++-------- b.test.db-journal | Bin 0 -> 12824 bytes package.json | 5 +- renderEngine/Command/Source/ws.js | 25 ++++++++- test/command/CommandUtil.js | 5 ++ test/command/external.ws.ws/simple.js | 45 +++++++++++++++++ test/connection/socket/app.js | 39 ++++++++++++++ test/connection/socket/command.js | 0 test/connection/socket/connection.js | 7 +++ 11 files changed, 165 insertions(+), 26 deletions(-) create mode 100644 b.test.db-journal create mode 100644 test/command/external.ws.ws/simple.js create mode 100644 test/connection/socket/app.js create mode 100644 test/connection/socket/command.js create mode 100644 test/connection/socket/connection.js diff --git a/.vscode/launch.json b/.vscode/launch.json index 5797a44..d7df9ef 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ "request": "launch", "name": "Launch Program", "skipFiles": ["/**"], - "program": "${workspaceFolder}\\test\\fileStreamer\\index.js" + "program": "${workspaceFolder}\\test\\command\\external.ws.ws\\simple.js" } ] } diff --git a/Models/Connection/ConnectionInfo.js b/Models/Connection/ConnectionInfo.js index 7bbe2d7..d5c8033 100644 --- a/Models/Connection/ConnectionInfo.js +++ b/Models/Connection/ConnectionInfo.js @@ -3,7 +3,7 @@ import DataSourceCollection from "../../renderEngine/Source/DataSourceCollection import IRoutingRequest from "../IRoutingRequest.js"; import Request from "../request.js"; import ILoadPageResult from "./ILoadPageResult.js"; - +import WebServerException from "../Exceptions/WebServerException.js"; export default class ConnectionInfo { /** @type {string} */ name; @@ -65,7 +65,7 @@ export default class ConnectionInfo { return new DataSourceCollection(retVal); } else { throw new WebServerException( - "Error from Edge Connection ;the sources are not available." + "Error from " + this.name + " Connection ;the sources are not available." ); } } diff --git a/Models/Connection/SocketConnectionInfo.js b/Models/Connection/SocketConnectionInfo.js index b916dd1..26a4c9d 100644 --- a/Models/Connection/SocketConnectionInfo.js +++ b/Models/Connection/SocketConnectionInfo.js @@ -12,14 +12,16 @@ import WebServerException from "../Exceptions/WebServerException.js"; */ export default class SocketConnectionInfo extends ConnectionInfo { /**@type {string} */ - endPoint; + host; + /**@type {string} */ + port; /** * @param {string} name * @param {SocketSettingData} settings */ constructor(name, settings) { super(name); - this.endPoint = settings.endPoint; + [this.host, this.port] = settings.endPoint.split(":"); } /** @@ -27,7 +29,7 @@ export default class SocketConnectionInfo extends ConnectionInfo { * @param {CancellationToken} cancellationToken * @returns {Promise} */ - async LoadDataAsync(cancellationToken, parameters) { + async loadDataAsync(parameters,cancellationToken) { const retVal = await this.sendAsync(parameters); return this.convertJSONToDataSet(retVal); } @@ -53,32 +55,47 @@ export default class SocketConnectionInfo extends ConnectionInfo { ? parameters["byteMessage"] : null; const mySocket = new net.Socket(); + await new Promise((resolve, reject) => { - mySocket.connect(this.EndPoint, () => { - resolve(); - }); + mySocket.connect( + { + host: this.host, + port: this.port, + }, + () => { + resolve(); + } + ); mySocket.on("error", (err) => { reject(err); }); }); + const networkStream = mySocket; - await new Promise((resolve, reject) => { - networkStream.write(byteMessage, (err) => { - if (err) { - reject(err); - } else { - resolve(); - } + + if (byteMessage) { + await new Promise((resolve, reject) => { + networkStream.write(byteMessage, (err) => { + if (err) { + reject(err); + } else { + resolve(); + } + }); }); - }); - return await new Promise((resolve, reject) => { - networkStream.read((err, data) => { - if (err) { - reject(err); - } else { - resolve(data); - } + } + let data = await new Promise((resolve, reject) => { + networkStream.on("data", (data) => { + const bufferString = data.toString("utf8"); + const jsonObject = JSON.parse(bufferString); + resolve(jsonObject); + }); + networkStream.on("error", (err) => { + reject(err); }); }); + networkStream.end(); + + return data; } } diff --git a/b.test.db-journal b/b.test.db-journal new file mode 100644 index 0000000000000000000000000000000000000000..a343c839b1b42832da39068a9edc78af279e8dd0 GIT binary patch literal 12824 zcmeI2&5P4O6u^^I?6S7a9)upG?1%?by7;lXxL%a0>#%g&rfD`V?INscny%4)ZJL4~ zco6B?iwBQ_N5Qj4@uYu&>`iZa@Zdp^6~U=A>CQkd@nm^JX=Wxfzs&m;3VA$1n6~YM z!!N861Bv_iTAUt z0Ad3JU;qq&0WbgtzyKHk1OJ}^GP)BN7UOH#)0*3B4lNID;j6#bcEvqI$l|aiV$NKKS*M{@caIc>q!VF3=A&FaQR?02lxRU;qq& z0WbgtzyKHk17KiQ3?#)^Mw+CE2GX}l{fD?!EjgZzT0OU8dT51Kf{3Dk5uz!A%QSRa z9}+Z?_KpQ3nm#zv59w0Ixz^Wlu0cwD5ad(z3mO;z17H9QfB`T72EYIq00UqE41j@u zF`!Au)47~j_smAy9_+X2TkY<^-XGdsiyy|;b&@v-GV<3-1aWJXuGz7d=+5lph8Rz0 zGUAi;U#9==>|Z5@;?FAcXwsY}DyRn8AUe|YLOHM3QIXV9{)SO0sB~|csK!#Tda_@o n4@U;6F?SrxM)bs`>FOheJ=|)h&W8mBMK} + */ + async _executeCommandAsync(context) { + if (this.members?.items.length > 0) { + const name = await this.name.getValueAsync(context); + const dataSet = await this.#loadDataAsync(name, context); + context.cancellation.throwIfCancellationRequested(); + if (dataSet.items.length != this.members.items.length) { + throw new BasisCoreException( + `Command ${name} has ${this.members.items.length} member(s) but ${dataSet.items.length} result(s) returned from source!` + ); + } + let index = 0; + for (const item of this.members.items) { + const source = dataSet.items[index++]; + await item.addDataSourceAsync(source, name, context); + } + } + return VoidResult.result; + } } diff --git a/test/command/CommandUtil.js b/test/command/CommandUtil.js index c642471..350e84f 100644 --- a/test/command/CommandUtil.js +++ b/test/command/CommandUtil.js @@ -13,6 +13,7 @@ import UnknownCommand from "../../renderEngine/Command/UnknownCommand.js"; import RepeaterCommand from "../../renderEngine/Command/Collection/RepeaterCommand.js"; import CookieCommand from "../../renderEngine/Command/CookieCommand.js"; import ClientComponent from "../../renderEngine/Command/ClientComponent.js"; +import WsCommand from "../../renderEngine/Command/Source/ws.js"; export default class CommandUtil { /** @@ -76,6 +77,10 @@ export default class CommandUtil { retVal = new ClientComponent(commandIl); break; } + case "external.ws.ws":{ + retVal = new WsCommand(commandIl) + break + } default: { retVal = new UnknownCommand(commandIl); break; diff --git a/test/command/external.ws.ws/simple.js b/test/command/external.ws.ws/simple.js new file mode 100644 index 0000000..bbc724e --- /dev/null +++ b/test/command/external.ws.ws/simple.js @@ -0,0 +1,45 @@ +import ServiceSettings from "../../../models/ServiceSettings.js"; +import CancellationToken from "../../../renderEngine/Cancellation/CancellationToken.js"; +import GroupCommand from "../../../renderEngine/Command/Collection/GroupCommand.js"; +import TestContext from "../../../renderEngine/Context/TestContext.js"; + +var setting = new ServiceSettings({ + Settings: { + "Connections.Socket.mydbsource": { + endPoint: "127.0.0.1:9090", + }, + }, +}); +const context = new TestContext(setting); +context.cancellation = new CancellationToken(); + +const groupIl = { + $type: "group", + core: "group", + name: "ROOT_GROUP", + Commands: [ + { + $type: "external.ws.ws", + core: "external.ws.ws", + name: "saman", + ConnectionName: "mydbsource", + Members: [ + { + name: "m1", + method: "RequestToken", + sort: "random", + content: + '\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n ', + }, + ], + }, + ], +}; + +const group = new GroupCommand(groupIl); +try { + const result = await group.executeAsync(context); + console.log(result); +} catch (ex) { + console.error(ex); +} diff --git a/test/connection/socket/app.js b/test/connection/socket/app.js new file mode 100644 index 0000000..c0dcd89 --- /dev/null +++ b/test/connection/socket/app.js @@ -0,0 +1,39 @@ +import net from "net"; + +const port = 9090; + +const server = net.createServer((socket) => { + console.log("Client connected"); + + socket.on("data", (message) => { + const strData = message.toString(); + const data = JSON.parse(strData); + console.log("Received: ", data); + const result = { + Replace: true, + sources: [ + { + data: { Time: 1, Percent: 1234 }, + }, + ], + }; + socket.write(JSON.stringify(result)); + socket.destroy(); + }); + + socket.on("end", () => { + console.log("Client disconnected"); + }); + + socket.on("error", (error) => { + console.log(`Socket Error: ${error.message}`); + }); +}); + +server.on("error", (error) => { + console.log(`Server Error: ${error.message}`); +}); + +server.listen(port, () => { + console.log(`TCP socket server is running on port: ${port}`); +}); diff --git a/test/connection/socket/command.js b/test/connection/socket/command.js new file mode 100644 index 0000000..e69de29 diff --git a/test/connection/socket/connection.js b/test/connection/socket/connection.js new file mode 100644 index 0000000..336004b --- /dev/null +++ b/test/connection/socket/connection.js @@ -0,0 +1,7 @@ +import SocketConnectionInfo from "./../../../models/Connection/SocketConnectionInfo.js"; + +const socket = new SocketConnectionInfo("TEST", { endPoint: "127.0.0.1:9090" }); +const encoder = new TextEncoder(); +const byteMessage = encoder.encode(JSON.stringify("tessssst")); +const result = await socket.loadDataAsync({ byteMessage }, null); +console.log("##############3", result.items[0].data); From a177e4b270a42e6a2182b8fe5d107543e63cd691 Mon Sep 17 00:00:00 2001 From: Ali Date: Tue, 7 May 2024 11:30:40 +0330 Subject: [PATCH 2/3] finalize --- Models/Connection/SocketConnectionInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Connection/SocketConnectionInfo.js b/Models/Connection/SocketConnectionInfo.js index 26a4c9d..94bc1d4 100644 --- a/Models/Connection/SocketConnectionInfo.js +++ b/Models/Connection/SocketConnectionInfo.js @@ -29,7 +29,7 @@ export default class SocketConnectionInfo extends ConnectionInfo { * @param {CancellationToken} cancellationToken * @returns {Promise} */ - async loadDataAsync(parameters,cancellationToken) { + async loadDataAsync(parameters, cancellationToken) { const retVal = await this.sendAsync(parameters); return this.convertJSONToDataSet(retVal); } From f50945e8e12d8dc63a77ad70f80e06a832d103bf Mon Sep 17 00:00:00 2001 From: Ali Date: Tue, 7 May 2024 17:29:40 +0330 Subject: [PATCH 3/3] finalize --- Models/Connection/ConnectionInfo.js | 21 +--- Models/Connection/EdgeConnectionInfo.js | 20 ++++ Models/Connection/SocketConnectionInfo.js | 60 ++++++------ .../Source/BaseClasses/SourceCommand.js | 4 +- .../Command/Source/BaseClasses/WsMember.js | 45 +++++++++ .../Source/BaseClasses/WsMemberCollection.js | 19 ++++ .../Command/Source/InlineSourceCommand.js | 1 - renderEngine/Command/Source/ws.js | 38 +++----- test/command/external.ws.ws/simple.js | 95 +++++++++++++++++++ test/connection/socket/app.js | 11 +-- test/connection/socket/command.js | 0 11 files changed, 225 insertions(+), 89 deletions(-) create mode 100644 renderEngine/Command/Source/BaseClasses/WsMember.js create mode 100644 renderEngine/Command/Source/BaseClasses/WsMemberCollection.js delete mode 100644 test/connection/socket/command.js diff --git a/Models/Connection/ConnectionInfo.js b/Models/Connection/ConnectionInfo.js index d5c8033..7a1ac6c 100644 --- a/Models/Connection/ConnectionInfo.js +++ b/Models/Connection/ConnectionInfo.js @@ -3,7 +3,7 @@ import DataSourceCollection from "../../renderEngine/Source/DataSourceCollection import IRoutingRequest from "../IRoutingRequest.js"; import Request from "../request.js"; import ILoadPageResult from "./ILoadPageResult.js"; -import WebServerException from "../Exceptions/WebServerException.js"; + export default class ConnectionInfo { /** @type {string} */ name; @@ -51,22 +51,5 @@ export default class ConnectionInfo { loadPageAsync(pageName, rawCommand, pageSize, domainId, cancellationToken) { throw new Error("ConnectionInfo.loadPageAsync() method not implemented."); } - /** - * - * @param {string} jsonString - * @returns {DataSourceCollection} - */ - convertJSONToDataSet(content) { - if (content?.sources && Array.isArray(content?.sources)) { - let retVal = []; - content.sources.forEach((source) => { - retVal.push(source.data); - }); - return new DataSourceCollection(retVal); - } else { - throw new WebServerException( - "Error from " + this.name + " Connection ;the sources are not available." - ); - } - } + } diff --git a/Models/Connection/EdgeConnectionInfo.js b/Models/Connection/EdgeConnectionInfo.js index b15159e..a2808e0 100644 --- a/Models/Connection/EdgeConnectionInfo.js +++ b/Models/Connection/EdgeConnectionInfo.js @@ -133,4 +133,24 @@ export default class EdgeConnectionInfo extends ConnectionInfo { }); }); } + /** + * + * @param {string} jsonString + * @returns {DataSourceCollection} + */ + convertJSONToDataSet(content) { + if (content?.sources && Array.isArray(content?.sources)) { + let retVal = []; + content.sources.forEach((source) => { + retVal.push(source.data); + }); + return new DataSourceCollection(retVal); + } else { + throw new WebServerException( + "Error from " + + this.name + + " Connection ;the sources are not available." + ); + } + } } diff --git a/Models/Connection/SocketConnectionInfo.js b/Models/Connection/SocketConnectionInfo.js index 94bc1d4..9352b03 100644 --- a/Models/Connection/SocketConnectionInfo.js +++ b/Models/Connection/SocketConnectionInfo.js @@ -2,7 +2,6 @@ import net from "net"; import ConnectionInfo from "./ConnectionInfo.js"; import DataSourceCollection from "../../renderEngine/Source/DataSourceCollection.js"; import SocketSettingData from "./SocketSettingData.js"; -import WebServerException from "../Exceptions/WebServerException.js"; /** * @typedef {Object} LoadDataRequest @@ -30,27 +29,6 @@ export default class SocketConnectionInfo extends ConnectionInfo { * @returns {Promise} */ async loadDataAsync(parameters, cancellationToken) { - const retVal = await this.sendAsync(parameters); - return this.convertJSONToDataSet(retVal); - } - /** - * @param {Request} request - * @param {CancellationToken} cancellationToken - * @returns {Promise} - */ - async getRoutingDataAsync(request, cancellationToken) { - const result = await this.loadDataAsync(request); - if (result.cms.webserver) { - result.webserver = result.cms.webserver; - delete result.cms.webserver; - } - if (result.cms.http) { - result.http = result.cms.http; - delete result.cms.http; - } - return result; - } - async sendAsync(parameters) { const byteMessage = parameters.hasOwnProperty("byteMessage") ? parameters["byteMessage"] : null; @@ -70,9 +48,7 @@ export default class SocketConnectionInfo extends ConnectionInfo { reject(err); }); }); - const networkStream = mySocket; - if (byteMessage) { await new Promise((resolve, reject) => { networkStream.write(byteMessage, (err) => { @@ -84,18 +60,36 @@ export default class SocketConnectionInfo extends ConnectionInfo { }); }); } - let data = await new Promise((resolve, reject) => { - networkStream.on("data", (data) => { - const bufferString = data.toString("utf8"); - const jsonObject = JSON.parse(bufferString); - resolve(jsonObject); - }); + let result = await new Promise((resolve, reject) => { + /** @type {Buffer[]}*/ + const buffer = []; + networkStream.on("data", (data) => buffer.push(data)); networkStream.on("error", (err) => { reject(err); }); + networkStream.on("end", () => { + const data = Buffer.concat(buffer); + const retVal = data.toString() + resolve( new DataSourceCollection([[{ result: retVal }]])); + }); }); - networkStream.end(); - - return data; + return result; + } + /** + * @param {Request} request + * @param {CancellationToken} cancellationToken + * @returns {Promise} + */ + async getRoutingDataAsync(request, cancellationToken) { + const result = await this.loadDataAsync(request); + if (result.cms.webserver) { + result.webserver = result.cms.webserver; + delete result.cms.webserver; + } + if (result.cms.http) { + result.http = result.cms.http; + delete result.cms.http; + } + return result; } } diff --git a/renderEngine/Command/Source/BaseClasses/SourceCommand.js b/renderEngine/Command/Source/BaseClasses/SourceCommand.js index 6af778c..068726e 100644 --- a/renderEngine/Command/Source/BaseClasses/SourceCommand.js +++ b/renderEngine/Command/Source/BaseClasses/SourceCommand.js @@ -42,7 +42,7 @@ export default class SourceCommand extends CommandBase { async _executeCommandAsync(context) { if (this.members?.items.length > 0) { const name = await this.name.getValueAsync(context); - const dataSet = await this.#loadDataAsync(name, context); + const dataSet = await this._loadDataAsync(name, context); context.cancellation.throwIfCancellationRequested(); if (dataSet.items.length != this.members.items.length) { throw new BasisCoreException( @@ -63,7 +63,7 @@ export default class SourceCommand extends CommandBase { * @param {IContext} context * @returns {Promise} */ - async #loadDataAsync(sourceName, context) { + async _loadDataAsync(sourceName, context) { const [connectionName, command, paramList] = await Promise.all([ this.connectionName.getValueAsync(context), this.toCustomFormatHtmlAsync(context), diff --git a/renderEngine/Command/Source/BaseClasses/WsMember.js b/renderEngine/Command/Source/BaseClasses/WsMember.js new file mode 100644 index 0000000..253446d --- /dev/null +++ b/renderEngine/Command/Source/BaseClasses/WsMember.js @@ -0,0 +1,45 @@ +import IContext from "../../../Context/IContext.js"; +import Member from "./Member.js"; +import CommandElement from "../../CommandElement.js"; +import TokenUtil from "../../../Token/TokenUtil.js"; + +export default class WsMember extends Member { + /** @type {IToken} */ + method; + /**@type {IToken} */ + query; + /** + * @param {object} memberIL + */ + constructor(memberIL) { + super(memberIL); + this.method = TokenUtil.getFiled(memberIL, "method"); + this.query = TokenUtil.getFiled(memberIL, "query"); + } + + /** + * @param {IContext} context + * @returns {Promise} + */ + async createHtmlElementAsync(context) { + const tag = new CommandElement("member"); + tag.addAttributeIfExist("name", this.name); + await Promise.all([ + tag.addAttributeIfExistAsync("preview", this.preview, context), + tag.addAttributeIfExistAsync("sort", this.sort, context), + tag.addAttributeIfExistAsync("method", this.method, context), + tag.addAttributeIfExistAsync("query", this.query, context), + ]); + if (this.extraAttributes) { + if (this.extraAttributes) { + await Promise.all( + Object.entries(this.extraAttributes).map((pair) => + tag.addAttributeIfExistAsync(pair[0], pair[1], context) + ) + ); + } + } + await tag.addRawContentIfExistAsync(this.rawContent, context); + return tag; + } +} diff --git a/renderEngine/Command/Source/BaseClasses/WsMemberCollection.js b/renderEngine/Command/Source/BaseClasses/WsMemberCollection.js new file mode 100644 index 0000000..ba9460f --- /dev/null +++ b/renderEngine/Command/Source/BaseClasses/WsMemberCollection.js @@ -0,0 +1,19 @@ +import JoinMember from "./JoinMember.js"; +import Member from "./Member.js"; +import MemberCollection from "./MemberCollection.js"; +import WsMember from "./wsmember.js"; + +export default class WSMemberCollection extends MemberCollection { + /** @param {object[]} membersIl */ + constructor(membersIl) { + super(membersIl); + } + + /** + * @param {object} memberIl + * @returns {Member} + */ + _createMember(memberIl) { + return new WsMember(memberIl); + } +} diff --git a/renderEngine/Command/Source/InlineSourceCommand.js b/renderEngine/Command/Source/InlineSourceCommand.js index 3d1c5bb..93b9ddd 100644 --- a/renderEngine/Command/Source/InlineSourceCommand.js +++ b/renderEngine/Command/Source/InlineSourceCommand.js @@ -1,7 +1,6 @@ import VoidResult from "../../Models/VoidResult.js"; import { InMemoryMemberCollection } from "./BaseClasses/InMemoryMemberCollection.js"; import SourceCommand from "./BaseClasses/SourceCommand.js"; -import IToken from "../../Token/IToken.js"; import ICommandResult from "../../Models/ICommandResult.js"; import IContext from "../../Context/IContext.js"; export default class InlineSourceCommand extends SourceCommand { diff --git a/renderEngine/Command/Source/ws.js b/renderEngine/Command/Source/ws.js index dbc87fb..02f7289 100644 --- a/renderEngine/Command/Source/ws.js +++ b/renderEngine/Command/Source/ws.js @@ -1,6 +1,10 @@ import SourceCommand from "./BaseClasses/SourceCommand.js"; import ICommandResult from "../../Models/ICommandResult.js"; import VoidResult from "../../Models/VoidResult.js"; +import IContext from "../../Context/IContext.js"; +import DataSourceCollection from "../../Source/DataSourceCollection.js"; +import WSMemberCollection from "./BaseClasses/WsMemberCollection.js"; +import MemberCollection from "./BaseClasses/MemberCollection.js"; export default class WsCommand extends SourceCommand { /** * @param {object} wsIl @@ -8,13 +12,19 @@ export default class WsCommand extends SourceCommand { constructor(wsIl) { super(wsIl); } - + /** + * @param {object[]} membersIl + * @returns {MemberCollection} + */ + createMemberCollection(membersIl) { + return new WSMemberCollection(membersIl); + } /** * @param {string} sourceName * @param {IContext} context - * @returns {Promise} + * @returns {Promise} */ - async #loadDataAsync(sourceName, context) { + async _loadDataAsync(sourceName, context) { const [connectionName, command] = await Promise.all([ this.connectionName.getValueAsync(context), this.toCustomFormatHtmlAsync(context), @@ -30,26 +40,4 @@ export default class WsCommand extends SourceCommand { }; return await context.loadDataAsync(sourceName, connectionName, parameters); } - /** - * @param {IContext} context - * @returns {Promise} - */ - async _executeCommandAsync(context) { - if (this.members?.items.length > 0) { - const name = await this.name.getValueAsync(context); - const dataSet = await this.#loadDataAsync(name, context); - context.cancellation.throwIfCancellationRequested(); - if (dataSet.items.length != this.members.items.length) { - throw new BasisCoreException( - `Command ${name} has ${this.members.items.length} member(s) but ${dataSet.items.length} result(s) returned from source!` - ); - } - let index = 0; - for (const item of this.members.items) { - const source = dataSet.items[index++]; - await item.addDataSourceAsync(source, name, context); - } - } - return VoidResult.result; - } } diff --git a/test/command/external.ws.ws/simple.js b/test/command/external.ws.ws/simple.js index bbc724e..21936b6 100644 --- a/test/command/external.ws.ws/simple.js +++ b/test/command/external.ws.ws/simple.js @@ -21,6 +21,9 @@ const groupIl = { { $type: "external.ws.ws", core: "external.ws.ws", + "extra-attribute": { + service: "saman", + procedurename: "sbserviceprocedure1", }, name: "saman", ConnectionName: "mydbsource", Members: [ @@ -33,6 +36,98 @@ const groupIl = { }, ], }, + { + $type: "inlinesource", + core: "inlinesource", + name: "view", + Members: [ + { + name: "item", + preview: "true", + content: ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `, + }, + { + name: "menu", + preview: "true", + content: ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `, + }, + ], + }, + { + $type: "Print", + core : "print", + "data-member-name": "saman.m1", + faces: [ + { + name: "face1", + content: "

-- @result
", + }, + ], + } ], }; diff --git a/test/connection/socket/app.js b/test/connection/socket/app.js index c0dcd89..4727703 100644 --- a/test/connection/socket/app.js +++ b/test/connection/socket/app.js @@ -9,15 +9,8 @@ const server = net.createServer((socket) => { const strData = message.toString(); const data = JSON.parse(strData); console.log("Received: ", data); - const result = { - Replace: true, - sources: [ - { - data: { Time: 1, Percent: 1234 }, - }, - ], - }; - socket.write(JSON.stringify(result)); + const result ="Hi from socket"; + socket.write(result); socket.destroy(); }); diff --git a/test/connection/socket/command.js b/test/connection/socket/command.js deleted file mode 100644 index e69de29..0000000