File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,34 @@ mutation($name: String!) {
159
159
</gql >
160
160
```
161
161
162
+ ** Subscriptions**
163
+ ``` html
164
+ <script setup lang =" ts" >
165
+ import { ref } from ' vue'
166
+ import { useSubscription } from ' vql'
167
+
168
+ const isPaused = ref (false )
169
+ const handleSubscription = (messages = [], response ) => {
170
+ return [response .newMessages , ... messages]
171
+ }
172
+
173
+ const { data } = useSubscription ({ from: ' Eren' }, { pause: isPaused }, handleSubscription)
174
+ </script >
175
+
176
+ <template >...</template >
177
+
178
+ <gql mutation >
179
+ subscription MessageSub($from: String!) {
180
+ newMessages(from: $from) {
181
+ id
182
+ from
183
+ text
184
+ }
185
+ }
186
+ </gql >
187
+ ```
188
+
189
+
162
190
## Roadmap
163
191
- [ ] Add support for fragments
164
192
- [ ] Investigate automatically generating queries from SFC templates
You can’t perform that action at this time.
0 commit comments