Skip to content

Commit 517f71f

Browse files
committed
updated readme with network info
1 parent 23ae3b7 commit 517f71f

File tree

1 file changed

+149
-2
lines changed

1 file changed

+149
-2
lines changed

README.md

Lines changed: 149 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ If you want to compile and skip the tests, you can use the standard maven approa
8686
* [Title Caps for field names and elements](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/bb246428(v=vs.85)?redirectedfrom=MSDN)
8787
* [No semi-colons for field names if labels exist](https://ux.stackexchange.com/questions/3611/should-label-and-field-be-separated-with-colon)
8888

89-
9089
## Contributing
9190

9291
All development is done on the `develop` branch. To contribute code, the typical approach is to create an issue about the feature/bug you're working on.
@@ -138,4 +137,152 @@ registry:
138137
resource: src/main/resources/resource
139138
type: Runtime
140139
virtual: false
141-
```
140+
```
141+
142+
# Network Distributed Architecture
143+
144+
## Websockets - Default Response for New Connection
145+
146+
```mermaid
147+
sequenceDiagram
148+
autonumber
149+
box Process Id p1
150+
participant runtime@p1
151+
end
152+
153+
box Process Id p2
154+
participant webgui@p2
155+
participant runtime@p2
156+
end
157+
158+
Note right of runtime@p1: Client runtime@p1 opens a <br/>websocket to remote webgui
159+
160+
runtime@p1->>webgui@p2: Connect<br/>ws://localhost:8888/api/messages?user=root&pwd=pwd&session_id=2309adf3dlkdk&id=p1
161+
162+
Note left of webgui@p2: Remote webgui@p2 and runtime@p2 attempt to subscribe <br/> to the describe method of the runtime@p1
163+
webgui@p2->>runtime@p1: addListener describe
164+
Note left of webgui@p2: runtime@p2 sends a describe request to runtime@p1
165+
webgui@p2->>runtime@p1: describe
166+
Note right of runtime@p1: runtime@p1 responds with a describe response
167+
runtime@p1->>webgui@p2: onDescribe
168+
Note left of webgui@p2: Based on the results of the describe,<br/> more querying and subscriptions can be processed
169+
170+
171+
%% opt Server Add Listener, Describe and Reserve
172+
%% end
173+
174+
175+
```
176+
177+
178+
### Minimal Message API Definition
179+
180+
```json
181+
{
182+
"name": "runtime",
183+
"method": "connect",
184+
"data": [
185+
"\"http://main.myrobotlab.org:8888\""
186+
],
187+
}
188+
189+
```
190+
191+
### Path API Definition
192+
```
193+
/{service-name}/{method-name}/{json-param1}/{json-param2}/{json-param3}...
194+
```
195+
The Path API definition is a simple way to define a RESTful API. The path is parsed and the service name, method name, and parameters are extracted. The parameters are json encoded and converted to the correct type when the method is invoked. The response is returned as a JSON object. The REST and CLI both use this API definition.
196+
197+
#### Examples
198+
```
199+
http://localhost:8888/runtime/getUptime
200+
http://localhost:8888/runtime/connect/"http://main.myrobotlab.org:8888"
201+
http://localhost:8888/arduino/connect/"COM3"
202+
```
203+
The exact same paths can be used in the CLI
204+
```
205+
/runtime/getUptime
206+
/runtime/connect/"http://main.myrobotlab.org:8888"
207+
/arduino/connect/"COM3"
208+
```
209+
210+
211+
### 1 Connection
212+
A connection with a websocket starts with an HTTP GET
213+
```
214+
ws://localhost:8888/api/messages?user=root&pwd=pwd&session_id=2309adf3dlkdk&id=p1
215+
```
216+
### 2 Subscribe to Runtime Describe
217+
When a connection is established between two different myrobotlab instances p1 and p2,
218+
the following messages are sent. The first message is adding a subscription to the runtime of the
219+
other process. The subscription is for the function "describe". The second message will be a describe request.
220+
```json
221+
{
222+
"msgId": 1690145377501,
223+
"name": "runtime",
224+
"sender": "webgui@p2",
225+
"sendingMethod": "",
226+
"historyList": [],
227+
"properties": null,
228+
"status": null,
229+
"encoding": "json",
230+
"method": "addListener",
231+
"data": [
232+
"{\"topicMethod\":\"describe\",\"callbackName\":\"runtime@caring-hector\",\"callbackMethod\":\"onDescribe\",\"class\":\"org.myrobotlab.framework.MRLListener\"}"
233+
],
234+
"class": "org.myrobotlab.framework.Message"
235+
}
236+
```
237+
### 3 Send Describe
238+
239+
```json
240+
{
241+
"msgId": 1690145377501,
242+
"name": "runtime",
243+
"sender": "webgui@p2",
244+
"sendingMethod": "",
245+
"historyList": [],
246+
"properties": null,
247+
"status": null,
248+
"encoding": "json",
249+
"method": "describe",
250+
"data": [
251+
"\"fill-uuid\"",
252+
"{\"id\":\"caring-hector\",\"uuid\":\"383b4070-2848-4c3d-85f4-e7f6e081d18e\",\"platform\":{\"os\":\"linux\",\"arch\":\"x86\",\"osBitness\":64,\"jvmBitness\":64,\"lang\":\"java\",\"vmName\":\"OpenJDK 64-Bit Server VM\",\"vmVersion\":\"11\",\"mrlVersion\":\"unknownVersion\",\"isVirtual\":false,\"id\":\"caring-hector\",\"branch\":\"develop\",\"pid\":\"1500044\",\"hostname\":\"t14-gperry\",\"commit\":\"55d0163663825dd0aaa10568bc01e035c7f21532\",\"build\":null,\"motd\":\"resistance is futile, we have cookies and robots ...\",\"startTime\":1690135873670,\"manifest\":{\"git.branch\":\"develop\",\"git.build.host\":\"t14-gperry\",\"git.build.time\":\"2023-07-23T10:38:46-0700\",\"git.build.user.email\":\"grog@myrobotlab.org\",\"git.build.user.name\":\"grog\",\"git.build.version\":\"0.0.1-SNAPSHOT\",\"git.closest.tag.commit.count\":\"13447\",\"git.closest.tag.name\":\"1.0.119\",\"git.commit.author.time\":\"2023-07-22T20:15:51-0700\",\"git.commit.committer.time\":\"2023-07-22T20:15:51-0700\",\"git.commit.id\":\"55d0163663825dd0aaa10568bc01e035c7f21532\",\"git.commit.id.abbrev\":\"55d0163\",\"git.commit.id.describe\":\"1.0.119-13447-g55d0163\",\"git.commit.id.describe-short\":\"1.0.119-13447\",\"git.commit.message.full\":\"Cron enhanced 2 (#1318)\\n\\n* Improved Cron and Cron history\\r\\n\\r\\n* forgot one\\r\\n\\r\\n* Teamwork fix of Hd44780\\r\\n\\r\\n* updated from review\",\"git.commit.message.short\":\"Cron enhanced 2 (#1318)\",\"git.commit.time\":\"2023-07-22T20:15:51-0700\",\"git.commit.user.email\":\"grog@myrobotlab.org\",\"git.commit.user.name\":\"GroG\",\"git.dirty\":\"false\",\"git.local.branch.ahead\":\"0\",\"git.local.branch.behind\":\"0\",\"git.remote.origin.url\":\"git@github.com-myrobotlab:MyRobotLab/myrobotlab.git\",\"git.tags\":\"1.1.1194\",\"git.total.commit.count\":\"14104\"},\"shortCommit\":\"55d0163\",\"class\":\"org.myrobotlab.framework.Platform\"},\"class\":\"org.myrobotlab.framework.DescribeQuery\"}"
253+
],
254+
"class": "org.myrobotlab.framework.Message"
255+
}
256+
257+
```
258+
259+
The describe message sends instance and platform information in return, the return data from describe, will return with an onDescribe message that contains all the service information from the remote (p2) process
260+
261+
### 4 Process onDescribe Response
262+
```json
263+
{
264+
"msgId":1692478237121,
265+
"name":"runtime@webgui-client",
266+
"sender":"runtime@unhealthy-giddy",
267+
"sendingMethod":"describe",
268+
"historyList":[
269+
"unhealthy-giddy"
270+
],
271+
"properties":null,
272+
"status":null,
273+
"encoding":"json",
274+
"method":"onDescribe",
275+
"data":[
276+
"{\"id\":\"unhealthy-giddy\",\"uuid\":null,\"request\":null,\"platform\":{\"os\":\"linux\",\"arch\":\"x86\",\"osBitness\":64,\"jvmBitness\":64,\"lang\":\"java\",\"vmName\":\"OpenJDK 64-Bit Server VM\",\"vmVersion\":\"11\",\"mrlVersion\":\"unknownVersion\",\"isVirtual\":false,\"id\":\"unhealthy-giddy\",\"branch\":\"grog\",\"pid\":\"2462761\",\"hostname\":\"t14-gperry\",\"commit\":\"5610a6602bef704a84160d7d067af3b417be1998\",\"build\":null,\"motd\":\"resistance is futile, we have cookies and robots ...\",\"startTime\":1692478154179,\"manifest\":{\"git.branch\":\"grog\",\"git.build.host\":\"t14-gperry\",\"git.build.time\":\"2023-08-19T09:36:36-0700\",\"git.build.user.email\":\"grog@myrobotlab.org\",\"git.build.user.name\":\"grog\",\"git.build.version\":\"0.0.1-SNAPSHOT\",\"git.closest.tag.commit.count\":\"13778\",\"git.closest.tag.name\":\"1.0.119\",\"git.commit.author.time\":\"2023-08-19T09:21:48-0700\",\"git.commit.committer.time\":\"2023-08-19T09:21:48-0700\",\"git.commit.\"class\":\"org.myrobotlab.framework.DescribeResults\"} .... WAY WAY TOO MUCH DATA !!!! ..."
277+
],
278+
"class":"org.myrobotlab.framework.Message"
279+
}
280+
```
281+
282+
The response back will include serialized services which should be refactor to be more minimal, and more describe parameters which can return interfaces or methods
283+
Services returned from the Describe request have been registered. By default they are only the currently "local" registered services.
284+
285+
The response should be refactored so that the material returned is related to criterial requested.
286+
For example, if only a list of services and their names are needed, that is all that is returned. If a specific service's interfaces are requested, then that is only returned.
287+
Fill-UUID should be refactored out.
288+

0 commit comments

Comments
 (0)