Skip to content

Commit 4175a60

Browse files
committed
Move this into design notes
1 parent 23ffecf commit 4175a60

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

TODO.md

-8
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@
6464
- Make typescript types for webxdc available as a standalone package so that
6565
developers can use this in their own projects.
6666

67-
## Architecture
68-
69-
- can we have only a single web socket that handles all frontends? We could
70-
broadcast to all clients at once. The drawbacks of this are that the client
71-
becomes dependent on more than just its own backend, and that we cannot
72-
easily distinguish between instances and make one of them broken in some way.
73-
It might also break CSP.
74-
7567
## Other
7668

7769
- Update webxdc specification based on what I learned about it.

design-notes.md

+25-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
1-
- I tried hard to make things work with Vite but had to go back to webpack to
2-
gain the control I needed -- I need to be able to produce a frontend UI
3-
bundle as well as the simulator `webxdc.js` bundle with a specific name. I
4-
couldn't get Vite to support that. webpack provides the required control, at
5-
the cost of more configuration.
1+
# Design notes
2+
3+
## one websocket per instance
4+
5+
Each instance has its own websocket it uses to communicate to the backend. It
6+
can be argued that only a single websocket is necessary that all instances use.
7+
This would allow a broadcast of messages to all clients at once.
8+
9+
But there are drawbacks as the client becomes dependent on more than its own
10+
backend. This would require an exception in CSP, which is doable. More
11+
difficult is that the client would need to know which port to connect to, which
12+
would somehow need to be injected into `webxdc.js`. In the current architecture
13+
the client can easily talk to its own host without any further knowledge.
14+
15+
## Webpack versus vite
16+
17+
I tried hard to make things work with Vite as this was already in use with
18+
other projects within the webxdc org, but had to go to webpack to gain the
19+
control I needed -- I need to be able to produce a frontend UI bundle as well
20+
as the simulator `webxdc.js` bundle with a specific name. I couldn't get Vite
21+
to support that. webpack provides the required control, at the cost of more
22+
configuration.
23+
24+
As an alternative I could have used `rollup` which should offer the control
25+
and is what vite itself uses.

0 commit comments

Comments
 (0)