🧩 Streamlit Protobuf Message Analysis (BackMsg)
This document decodes the provided hexadecimal data stream, identifying its structure as a Streamlit BackMsg. This message is sent from the user’s browser (client) to the Streamlit server (backend) to communicate user interactions, specifically widget updates and a form submission.
The message includes state changes for two text inputs and an explicit signal that a form has been submitted.
1. Hexadecimal Data Stream
5A F4 01 0A 00 12 C9 01 0A 3A 0A 31 24 24 57 49 44 47 45 54 5F 49 44 2D 32 33 32 61 66 31 63 37 62 34 30 39 35 66 30 35 34 34 63 39 61 36 37 63 30 38 35 34 61 35 37 34 2D 4E 6F 6E 65 32 05 61 64 6D 69 6E 0A 3A 0A 31 24 24 57 49 44 47 45 54 5F 49 44 2D 64 63 63 65 31 63 62 39 38 36 61 32 32 35 66 32 37 31 62 63 39 31 33 61 34 63 66 35 32 64 34 38 2D 4E 6F 6E 65 32 05 61 64 6D 69 6E 0A 4F 0A 4B 24 24 57 49 44 47 45 54 5F 49 44 2D 63 34 39 36 66 39 30 62 63 38 64 31 34 63 36 32 35 38 37 63 33 33 38 66 33 36 62 64 65 34 32 66 2D 46 6F 72 6D 53 75 62 6D 69 74 74 65 72 3A 6C 6F 67 69 6E 5F 66 6F 72 6D 2D 4C 6F 67 69 6E 10 01 1A 20 39 65 34 36 39 66 36 34 64 39 62 30 30 30 35 66 64 36 65 39 62 33 34 38 61 61 34 66 35 35 32 66 22 00 2A 00
2. Top-Level Decoding (BackMsg Structure)
The message is decoded using the Protobuf Tag-Length-Value (TLV) system.
| Bytes | Tag/Length Analysis | Streamlit Field (Conceptual) | Value/Length |
5A F4 01 | Tag 11 (Wire Type 2: Length-Delimited) | Widget States Map | Length: 244 bytes |
0A 00 | Tag 1 (Wire Type 2) | Empty message | Length: 0 |
12 C9 01 | Tag 2 (Wire Type 2) | Widget Updates Data | Length: 201 bytes |
1A 20 | Tag 3 (Wire Type 2) | Report Hash | Length: 32 bytes |
22 00 | Tag 4 (Wire Type 2) | Sync Request | Length: 0 |
2A 00 | Tag 5 (Wire Type 2) | Page Info | Length: 0 |
3. Detailed Widget Updates (The Core Action)
The 201 bytes of Widget Updates Data (12 C9 01) contains a map of three key-value pairs, where the key is the widget ID and the value is the widget’s new state.
➡️ Widget 1: Text Input Update
| Protobuf Field | Decoded Hex | Decoded Data | Meaning |
| Key (ID) | 0A 31 [...] | $$WIDGET_ID-232af1c7b4095f0544c9a67c0854a574-None | Unique ID of the first text input widget. |
| Value | 32 05 61 64 6D 69 6E | admin | The user entered the string admin. |
➡️ Widget 2: Text Input Update
| Protobuf Field | Decoded Hex | Decoded Data | Meaning |
| Key (ID) | 0A 31 [...] | $$WIDGET_ID-dcce1cb986a225f271bc913a4cf52d48-None | Unique ID of the second text input widget. |
| Value | 32 05 61 64 6D 69 6E | admin | The user entered the string admin. |
➡️ Widget 3: Form Submission (The New Action)
| Protobuf Field | Decoded Hex | Decoded Data | Meaning |
| Key (ID) | 0A 4B [...] | $$WIDGET_ID-c496f90bc8d14c62587c338f36bde42f-FormSubmitter:login_form-Login | ID of the submit button/widget. Crucially, it includes FormSubmitter and the form key login_form. |
| Value | 10 01 | true (1) | The button was clicked, setting its state to True. |
4. Summary of User Action
This single BackMsg represents the following user interaction on the Streamlit application:
- The user typed the value
admininto two distinct input fields (e.g., username and password). - The user then clicked a submit button associated with a
with st.form("login_form"):block.
The server will receive this message, update its internal state for all three widgets, and rerun the Streamlit script to process the login form logic.
5. Report Hash for Synchronization
The message concludes with the Report Hash field (1A 20):
- Hash:
9e469f64d9b0005fd6e9b348aa4f552f
This hash is the unique identifier for the report (the output generated by the last script run) that created the widgets. This ensures the client’s updates are applied to the correct version of the application state on the server.