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
Copy file name to clipboardExpand all lines: README.md
+15-20Lines changed: 15 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,42 +135,35 @@ In the future, additional flags may be added to allow you to include tables, add
135
135
136
136
## Plugins
137
137
138
-
If you would like to implement your own `valueFuncs`, you can do so by writing a ripoff plugin.
139
-
140
-
Plugins are local unauthenticated TCP servers that consume and emit newline-separated JSON messages from ripoff.
138
+
If you would like to implement your own `valueFuncs`, you can do so by writing a ripoff plugin, which is a local TCP server that sends/recieves JSON.
141
139
142
140
### Writing a plugin
143
141
144
-
Plugins must listen to a local TCP port and provide a TCP stream (loop of receiving and sending messages) to clients.
142
+
Plugins must meet the following requirements:
145
143
146
-
On startup, plugins must output the string `READY` in its first line of output to indicate to ripoff that it is ready to receive TCP messges.
144
+
- Listen to a local TCP port
145
+
- Consume newline-separated JSON messages, which come in as a stream
146
+
- Output newline-separated JSON responses
147
+
- Ouput `READY` in the first line of standard output when the plugin is ready for TCP connections
147
148
148
-
Each incoming message will be a single line of JSON in the following types:
149
+
Each incoming message will be a single line of JSON of the following shapes:
149
150
150
-
#### Return a value
151
+
#### valueFunc
151
152
152
153
Your plugin must process an arbitrary `valueFunc` and return a string value. You can decide how to handle functions you do not expect/provide, by either returning an empty value or disconnecting the client.
153
154
155
+
The `id` field is used to support unordered stream messages, so you can return responses at any time and in any order as long as they have the same `id` as the relevant request.
@@ -179,7 +172,9 @@ An example plugin can be found at `cmd/helloplugin/helloplugin.go`. although TCP
179
172
180
173
### Using a plugin
181
174
182
-
Plugins are defined in your ripoff files, which instruct ripoff to spawn a process to start your TCP server, then later connect to it with a single TCP stream. Here's an example from ripoff's tests:
175
+
Plugins are defined in your ripoff files, which instruct ripoff to spawn a process to start your TCP server.
0 commit comments