You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: serial_protocol.md
+40-13Lines changed: 40 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Must be called after creating a Serial connection, it can take either just a hos
43
43
>> BEGIN https://samplechat.firebaseio-demo.com nnz...sdf
44
44
<< +OK
45
45
##GET
46
-
Fetches the value at $Path and returns it on the serial line. If $PATH points to a leaf node you will get the raw value back, if it points to an internal node you will get a JSON string with all children.
46
+
Fetches the value at $PATH and returns it on the serial line. If $PATH points to a leaf node you will get the raw value back, if it points to an internal node you will get a JSON string with all children.
47
47
###Usage
48
48
GET $PATH
49
49
###Response
@@ -78,10 +78,10 @@ Store the data provided at the path provided. This method should be used for sim
78
78
+OK
79
79
-FAIL
80
80
###Examples
81
-
>>SET /user/aturning/first Alan
81
+
>>SET /user/aturing/first Alan
82
82
<<+OK
83
83
##SET$
84
-
Similar to SET above but used to write multiline strings or raw binary data. Data format is similar to the batch string ($) return type, we specify the $DATA_BYTE_COUNT on the same line as SET$ then a newline and all data.
84
+
Similar to SET above but used to write multiline strings or raw binary data. Data format is similar to the batch string ($) return type, we specify the $DATA_BYTE_COUNT on the same line as SET$ then a newline and all data. However which the batch string ($) return type returns data json escaped and quoted you may provide raw data and we will handle the escaping.
85
85
86
86
Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of data before becoming responsive again.
87
87
###Usage
@@ -92,10 +92,25 @@ Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of
92
92
-FAIL
93
93
-FAIL_TIMEOUT
94
94
###Examples
95
-
>>SET /user/aturning/address 24
95
+
>>SET /user/aturing/address 24
96
96
>>78 High Street,
97
97
>>Hampton
98
98
<<+OK
99
+
100
+
##SET{+,*,#,.,?}
101
+
Same as SET but will force the value to be stored in the given type or return an error if we cannot parse it as that type.
102
+
###Usage
103
+
SET+ $PATH $VALUE
104
+
SET: $PATH $VALUE
105
+
SET? $PATH $VALUE
106
+
###Response
107
+
+OK
108
+
-INCORRECT_TYPE
109
+
###Examples
110
+
>>SET? /user/aturing/was_human true
111
+
<<+OK
112
+
>>SET? /user/aturing/was_human He was not a computer.
113
+
<<-INCORRECT_TYPE
99
114
100
115
##REMOVE
101
116
Deletes the value located at the path provided.
@@ -105,7 +120,7 @@ Deletes the value located at the path provided.
105
120
+OK
106
121
-FAIL
107
122
###Examples
108
-
>>REMOVE /user/aturning
123
+
>>REMOVE /user/aturing
109
124
<<+OK
110
125
111
126
##PUSH
@@ -115,43 +130,55 @@ Adds a value to the list located at the path provided and returns the key at whi
115
130
###Response
116
131
$KEY
117
132
###Examples
118
-
>>PUSH /user/aturning/login_timestamps 1455052043
133
+
>>PUSH /user/aturing/login_timestamps 1455052043
119
134
<<+-K94eLnB0rAAvfkh_WC2
120
135
121
136
##PUSH$
122
137
Similar to PUSH but used to write multiline strings or raw binary data. Data format is similar to the batch string ($) return type, we specify the $DATA_BYTE_COUNT on the same line as SET$ then a newline and all data. However you are not required to json escape all of your data, that will be handled for you.
123
138
124
139
Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of data before becoming responsive again.
125
140
###Usage
126
-
PUSH_BULK $PATH $DATA_BYTE_COUNT
141
+
PUSH$ $PATH $DATA_BYTE_COUNT
127
142
$DATA
128
143
###Response
129
144
$KEY
130
145
###Examples
131
-
>>PUSH /user/aturning/quotes 91
146
+
>>PUSH /user/aturing/quotes 91
132
147
>>We can only see a short distance ahead,
133
148
>>but we can see plenty there that needs to be done.
134
149
<<+-K94eLnB0rAAvfkh_WC3
135
150
136
-
##STREAM
151
+
##BEGIN_STREAM
137
152
Used to register to receive a stream of events that occur to the object at the provided path.
138
153
139
154
After registering you will start receiving events on the response line. They will be formatted as one line with the event type {PUT,PATCH,etc..} followed by the sub_path that changed and the other line with the data associated with that event type. This data will be formatted similar to GET results and can have multi-line batch strings (*) or json strings (&).
140
155
141
156
The event stream will continue until you send CANCEL_STREAM.
142
157
###Usage
143
-
STREAM $PATH
144
-
CANCEL_STREAM
158
+
BEGIN_STREAM $PATH
145
159
###Response
146
160
$EVENT_NAME $SUB_PATH
147
161
$DATA
148
162
+OK
149
163
###Examples
150
-
>>STREAM /user/aturning
164
+
>>BEGIN_STREAM /user/aturing
151
165
<<+PUT /last_login
152
166
<<:1455052043
153
167
<<+PUT /address
154
168
<<$24
155
169
<<"78 High Street,\r\nHampton"
156
-
>>CANCEL_STREAM
170
+
171
+
##END_STREAM
172
+
Used to stop listening to events at a given path. This must be the same path provided to a previous BEGIN_STREAM call.
0 commit comments