Skip to content

Connection resume #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 167 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
3a84b2a
wip connection robustness
JamesHutchison Feb 28, 2024
03d4cff
Try fixing double execution bug for scripts
JamesHutchison Feb 28, 2024
20953d0
socket check
JamesHutchison Feb 28, 2024
8a4f1e0
debug
JamesHutchison Feb 28, 2024
ab14c85
slow socketLoop and add debug message
JamesHutchison Feb 28, 2024
b940c51
attempt at bug fix
JamesHutchison Feb 28, 2024
45dae0b
Remove reconnecting from web socket creation behavior
JamesHutchison Feb 28, 2024
c62c3ec
Make loop restart on reconnection
JamesHutchison Feb 28, 2024
5c03f17
have client track if its sleeping
JamesHutchison Feb 28, 2024
845e5d4
WIP reconnecting
JamesHutchison Feb 29, 2024
7ecf4d2
add reconnecting arg
JamesHutchison Feb 29, 2024
c56746e
Change sanic to do handle_connection
JamesHutchison Feb 29, 2024
6225cf1
is ready controls
JamesHutchison Feb 29, 2024
f25dbd7
move indicate ready
JamesHutchison Feb 29, 2024
49c849d
give states a key
JamesHutchison Feb 29, 2024
17780e2
server_only and send over state vars
JamesHutchison Feb 29, 2024
4303577
simplify for testing
JamesHutchison Feb 29, 2024
d935805
inital work client taking in statevars
JamesHutchison Feb 29, 2024
dc67af0
WIP client_state (python side)
JamesHutchison Feb 29, 2024
4f8111f
wip
JamesHutchison Feb 29, 2024
68272fd
wip
JamesHutchison Feb 29, 2024
8dbdc52
deterministic target names
JamesHutchison Feb 29, 2024
c89756e
wip restoration with serializer, not yet hooked up
JamesHutchison Mar 1, 2024
56d9f7b
rename custom serializer to default serializer
JamesHutchison Mar 1, 2024
4a6d7c9
wip
JamesHutchison Mar 1, 2024
8b0bb4b
wip
JamesHutchison Mar 1, 2024
a353d42
wip
JamesHutchison Mar 1, 2024
f8044ac
wip
JamesHutchison Mar 1, 2024
c47ebeb
store salt on client
JamesHutchison Mar 1, 2024
126441f
wip
JamesHutchison Mar 1, 2024
12e2dbd
wip
JamesHutchison Mar 1, 2024
4ddce1d
wip
JamesHutchison Mar 1, 2024
39f9b46
wip
JamesHutchison Mar 1, 2024
2106d52
wip
JamesHutchison Mar 1, 2024
0234ae0
wip
JamesHutchison Mar 1, 2024
daaec4e
wip
JamesHutchison Mar 1, 2024
c2b6c52
wip
JamesHutchison Mar 1, 2024
7a3b27a
wip
JamesHutchison Mar 1, 2024
5dd5caf
wip
JamesHutchison Mar 1, 2024
b028ec6
wip
JamesHutchison Mar 1, 2024
ea3c1e5
wip
JamesHutchison Mar 1, 2024
00ee75a
Reuse previous salt
JamesHutchison Mar 1, 2024
6ea67ea
wip
JamesHutchison Mar 1, 2024
9dd6fc0
Add recovery to use_ref and support UUID
JamesHutchison Mar 1, 2024
b647c55
wip
JamesHutchison Mar 1, 2024
00228d0
wip
JamesHutchison Mar 1, 2024
c204229
wip
JamesHutchison Mar 1, 2024
941d377
wip
JamesHutchison Mar 1, 2024
2f3da7e
wip
JamesHutchison Mar 1, 2024
4340dcf
wip
JamesHutchison Mar 1, 2024
e153a89
wip
JamesHutchison Mar 1, 2024
18e82eb
fixes
JamesHutchison Mar 1, 2024
7069182
wip
JamesHutchison Mar 1, 2024
b50f7ef
wip
JamesHutchison Mar 1, 2024
2c4408d
wip
JamesHutchison Mar 1, 2024
b082896
wip
JamesHutchison Mar 1, 2024
88dae24
wip
JamesHutchison Mar 1, 2024
8e11865
wip
JamesHutchison Mar 1, 2024
f0cc884
wip
JamesHutchison Mar 1, 2024
7a3e8dd
wip
JamesHutchison Mar 1, 2024
1da2dd0
wip
JamesHutchison Mar 1, 2024
966df84
working better
JamesHutchison Mar 1, 2024
0a65c33
Bump up objects and length limits
JamesHutchison Mar 1, 2024
0d46a04
wip
JamesHutchison Mar 1, 2024
ea929e9
adjust background intervals
JamesHutchison Mar 2, 2024
23661b3
move ReconnectingOnly to export
JamesHutchison Mar 2, 2024
f00b49c
support nested use_state in components
JamesHutchison Mar 2, 2024
90015c9
wip
JamesHutchison Mar 2, 2024
25682b2
wip
JamesHutchison Mar 2, 2024
b48910a
state_var_lock
JamesHutchison Mar 2, 2024
1262342
wip
JamesHutchison Mar 2, 2024
3e9a921
organize imports
JamesHutchison Mar 2, 2024
cecdd85
wip
JamesHutchison Mar 2, 2024
c885c2d
stop logging state vars
JamesHutchison Mar 2, 2024
81a2ff1
reconnect refactor
JamesHutchison Mar 2, 2024
465ce37
wip
JamesHutchison Mar 2, 2024
6a31737
implement maximum state size
JamesHutchison Mar 2, 2024
8e0099c
wip
JamesHutchison Mar 2, 2024
aff1572
wip
JamesHutchison Mar 2, 2024
1222341
wip
JamesHutchison Mar 2, 2024
16cedc5
Support events coming in late
JamesHutchison Mar 2, 2024
0083c60
support serializing and deserializing lists of objects
JamesHutchison Mar 2, 2024
a5306c7
wip
JamesHutchison Mar 2, 2024
25a1508
wip
JamesHutchison Mar 2, 2024
04ca431
increase OTP digits
JamesHutchison Mar 2, 2024
c60e291
Change state key to sha256 with digits thrown away
JamesHutchison Mar 2, 2024
0d3df4a
Add ability to check older and future codes
JamesHutchison Mar 2, 2024
e9bb90f
Switch from ThreadLocal to ContextVar
JamesHutchison Mar 3, 2024
5798fd1
changes for async support
JamesHutchison Mar 3, 2024
df2e137
wip
JamesHutchison Mar 3, 2024
87b9493
wip
JamesHutchison Mar 3, 2024
3100b80
wip
JamesHutchison Mar 3, 2024
60b28f6
wip
JamesHutchison Mar 3, 2024
6b76db0
wip
JamesHutchison Mar 3, 2024
fc60668
add otp mixer
JamesHutchison Mar 3, 2024
0e90992
wip
JamesHutchison Mar 3, 2024
675966f
wip
JamesHutchison Mar 3, 2024
cee390d
refactor
JamesHutchison Mar 3, 2024
91ff583
refactor to use contextvar
JamesHutchison Mar 3, 2024
ffd4dcd
wip
JamesHutchison Mar 3, 2024
e723239
wip
JamesHutchison Mar 3, 2024
b6b77ec
wip
JamesHutchison Mar 3, 2024
242b529
wip
JamesHutchison Mar 3, 2024
3602438
wip
JamesHutchison Mar 3, 2024
6ff7bf5
wip
JamesHutchison Mar 3, 2024
0ca5752
wip
JamesHutchison Mar 3, 2024
8520c42
wip
JamesHutchison Mar 3, 2024
20dfece
wip
JamesHutchison Mar 3, 2024
8e1e4f2
wip
JamesHutchison Mar 3, 2024
972153e
partial revert
JamesHutchison Mar 3, 2024
d796d5e
wip
JamesHutchison Mar 3, 2024
385a521
wip
JamesHutchison Mar 3, 2024
7fb6b1b
wip
JamesHutchison Mar 3, 2024
5fcb3e9
reverting
JamesHutchison Mar 3, 2024
652f703
wip
JamesHutchison Mar 3, 2024
0cc4f72
perf tweaks
JamesHutchison Mar 4, 2024
7f7cab6
double state objects
JamesHutchison Mar 4, 2024
6be7d03
wip
JamesHutchison Mar 4, 2024
45ca27a
wip
JamesHutchison Mar 4, 2024
74a1946
wip
JamesHutchison Mar 4, 2024
b089a35
wip
JamesHutchison Mar 4, 2024
abce8da
wip
JamesHutchison Mar 4, 2024
f1dfaf4
wip
JamesHutchison Mar 4, 2024
06fa110
add priority
JamesHutchison Mar 4, 2024
a652318
wip
JamesHutchison Mar 4, 2024
26c4ff9
wip
JamesHutchison Mar 4, 2024
e35457e
wip
JamesHutchison Mar 4, 2024
67548fe
wip
JamesHutchison Mar 4, 2024
8dbbee2
cache previous state
JamesHutchison Mar 4, 2024
dbcc09a
wip
JamesHutchison Mar 4, 2024
d014012
wip
JamesHutchison Mar 4, 2024
d737dd9
wip
JamesHutchison Mar 4, 2024
e609382
wip
JamesHutchison Mar 4, 2024
df946eb
wip
JamesHutchison Mar 4, 2024
595316f
wip
JamesHutchison Mar 4, 2024
3f18e25
wip
JamesHutchison Mar 4, 2024
880bcf8
perf
JamesHutchison Mar 4, 2024
508255f
wip
JamesHutchison Mar 4, 2024
350ef04
add retries
JamesHutchison Mar 4, 2024
33d5490
wip
JamesHutchison Mar 4, 2024
a5bfad6
wip
JamesHutchison Mar 4, 2024
6d43e99
wip
JamesHutchison Mar 4, 2024
6d743ea
efwf
JamesHutchison Mar 4, 2024
c9791d3
add connectoin timeout
JamesHutchison Mar 4, 2024
02eb80d
wip
JamesHutchison Mar 4, 2024
8a44cf2
wip
JamesHutchison Mar 5, 2024
fd5f0bd
wip
JamesHutchison Mar 5, 2024
a127f1a
wip
JamesHutchison Mar 5, 2024
7fe56d6
wip
JamesHutchison Mar 5, 2024
6d7933b
wip
JamesHutchison Mar 5, 2024
d6ebb48
wip
JamesHutchison Mar 5, 2024
95d7e82
wip
JamesHutchison Mar 5, 2024
f92e363
wip
JamesHutchison Mar 5, 2024
18bf283
reset retries remaining on retry interval reset
JamesHutchison Mar 5, 2024
72ebebf
wip
JamesHutchison Mar 5, 2024
f8e3978
wip
JamesHutchison Mar 5, 2024
e1ff31d
adjust jitter
JamesHutchison Mar 5, 2024
4103784
wip
JamesHutchison Mar 5, 2024
eb76afc
wip
JamesHutchison Mar 5, 2024
25c6de4
wip
JamesHutchison Mar 5, 2024
d1ac36f
wip
JamesHutchison Mar 5, 2024
29c2419
wip
JamesHutchison Mar 5, 2024
ac12918
wip
JamesHutchison Mar 5, 2024
5d9efbd
wip
JamesHutchison Mar 5, 2024
54a8b6c
Merge branch 'main' into connection-resume
JamesHutchison Mar 5, 2024
d556eb5
cleanup
JamesHutchison Mar 5, 2024
4960908
merge fixes
JamesHutchison Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 10 additions & 17 deletions src/js/packages/@reactpy/client/src/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ export function Layout(props: { client: ReactPyClient }): JSX.Element {

useEffect(
() =>
props.client.onMessage("layout-update", ({ path, model }) => {
props.client.onMessage("layout-update", ({ path, model, state_vars }) => {
if (path === "") {
Object.assign(currentModel, model);
} else {
setJsonPointer(currentModel, path, model);
}
props.client.updateStateVars(state_vars);
forceUpdate();
}),
[currentModel, props.client],
Expand Down Expand Up @@ -125,23 +126,15 @@ function ScriptElement({ model }: { model: ReactPyVdom }) {
(value): value is string => typeof value == "string",
)[0];

let scriptElement: HTMLScriptElement;
if (model.attributes) {
scriptElement = document.createElement("script");
for (const [k, v] of Object.entries(model.attributes)) {
scriptElement.setAttribute(k, v);
}
if (scriptContent) {
scriptElement.appendChild(document.createTextNode(scriptContent));
}
ref.current.appendChild(scriptElement);
} else if (scriptContent) {
const scriptResult = eval(scriptContent);
if (typeof scriptResult == "function") {
return scriptResult();
}
const scriptElement: HTMLScriptElement = document.createElement("script");
for (const [k, v] of Object.entries(model.attributes || {})) {
scriptElement.setAttribute(k, v);
}
if (scriptContent) {
scriptElement.appendChild(document.createTextNode(scriptContent));
}
}, [model.key, ref.current]);
ref.current.appendChild(scriptElement);
}, [model.key]);

return <div ref={ref} />;
}
Expand Down
9 changes: 7 additions & 2 deletions src/js/packages/@reactpy/client/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export type LayoutEventMessage = {
data: any;
};

export type IncomingMessage = LayoutUpdateMessage;
export type OutgoingMessage = LayoutEventMessage;
export type ReconnectingCheckMessage = {
type: "reconnecting-check";
value: string;
}

export type IncomingMessage = LayoutUpdateMessage | ReconnectingCheckMessage;
export type OutgoingMessage = LayoutEventMessage | ReconnectingCheckMessage;
export type Message = IncomingMessage | OutgoingMessage;
Loading