# Relationship between saved pattern and websocket changes?

**URL:** <https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719>\
**Category:** Uncategorized\
**Created:** [July 14, 2026, 12:49am UTC](https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719 "2026-07-14T00:49:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kptb](https://forum.electromage.com/letter_avatar_proxy/v4/letter/k/f1d935/32.png) [@kptb](https://forum.electromage.com/u/kptb)\
**Post date:** [July 14, 2026, 12:49am UTC](https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719/1 "2026-07-14T00:49:15Z")

</div>

I am using a base pattern with a lot of variables, which I am changing via WS commands on a streamdeck keypad.

The sketch is changing in line with the commands, and I understand we are advised not to use WS commands and the web editor at the same time. but is there any way to make those WS updates ‘save’ to the cached sketch? After a reboot, or if I go into the editor mode later on, the sketch still holds the values from the original sketch, and the ‘edit ‘ mode is empty until I load a sketch, even though there is a cached sketch showing…

Is there any way around this?

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [July 14, 2026, 4:45am UTC](https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719/2 "2026-07-14T04:45:17Z")

</div>

The best way to do this is controls, but unfortunately can cause some animation stutter.

Ui controls can be persisted. The ui itself uses these, while you slide a slider it streams the data over without persisting it, then once the value stops changing for a while, sends it again with save:true to persist it.

Next time the pattern loads, all the old values are loaded in to it before the first frame of animation.

But the save can cause a small stutter in animation. If you save super frequently it will be choppy, and causes flash wear if you do it in loop or on every value change.

---

<div class="post-metadata">

**Author:** ![kptb](https://forum.electromage.com/letter_avatar_proxy/v4/letter/k/f1d935/32.png) [@kptb](https://forum.electromage.com/u/kptb)\
**Post date:** [July 14, 2026, 4:33pm UTC](https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719/3 "2026-07-14T16:33:18Z")

</div>

Interesting info.

Is there a way to get web socket updates to follow that “save if its static for a while” behaviour you mention with controls?

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [July 14, 2026, 5:14pm UTC](https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719/4 "2026-07-14T17:14:09Z")

</div>

It’s implemented on the client side, it uses a debounce function and resends the last controls with save:true. Doesn’t exist on the websocket server side unfortunately. No saveLater option.

---

<div class="post-metadata">

**Author:** ![kptb](https://forum.electromage.com/letter_avatar_proxy/v4/letter/k/f1d935/32.png) [@kptb](https://forum.electromage.com/u/kptb)\
**Post date:** [July 15, 2026, 4:28am UTC](https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719/5 "2026-07-15T04:28:34Z")

</div>

No worries. I am sure you would have mentioned it if there was, but is there any websocket command to explicitly write to the sketch?

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [July 16, 2026, 5:55pm UTC](https://forum.electromage.com/t/relationship-between-saved-pattern-and-websocket-changes/4719/6 "2026-07-16T17:55:30Z")

</div>

For controls, or do you mean updating the pattern code?

Controls, yes, it’s pretty easy and it’s documented on the website. [https://electromage.com/docs/websockets-api](https://electromage.com/docs/websockets-api)

Pattern code is tricky because the chip can’t compile source. You would need to extract the compiler from the page and be able to run JavaScript, and it has a less user-friendly binary interface. However, @zranger1 ‘s python client library does all of that! Still, this is heavier than controls and the same persistence thing is worse if you want to persist a whole updated pattern.
