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 May 17, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,28 @@
3
3
4
4
This is a fork of [subscriptionless](https://github.com/andyrichardson/subscriptionless) that is built to work with [Architect](https://arc.codes) and tested with the [Architect Sandbox](https://arc.codes/docs/en/reference/cli/sandbox). There's no reason why it wont work with Serverless or other deploy tools but their support is not a goal.
Subscribe is the most important method in the library. It's the primary difference between `graphql-ws` and `graphql-lambda-subscriptions`. It returns a `SubscribePseudoIterable` that pretends to be an async iterator that you put on the `subscribe` resolver for your Subscription. In reality it includes a few properties that we use to subscribe to events and fire lifecycle functions.
-`topic`: The you subscribe to the topic and can filter based upon the topics payload.
22
+
-`filter`: An object that the payload will be matched against (or a function that produces the object). If the payload's field matches the subscription will receive the event. If the payload is missing the field the subscription will receive the event.
23
+
-`onSubscribe`: A function that gets the subscription information (like arguments) it can throw if you don't want the subscription to subscribe.
24
+
-`onAfterSubscribe`: A function that gets the subscription information (like arguments) and can fire initial events or record information.
25
+
-`onComplete`: A function that fires at least once when a connection disconnects, a client sends a "complete" message, or the server sends a "complete" message. Because of the nature of aws lambda, it's possible for a client to send a "complete" message and disconnect and those events executing on lambda out of order. Which why this function can be called up to twice.
26
+
27
+
## Old Readme
8
28
9
29
## About
10
30
@@ -282,7 +302,7 @@ Wrap any `subscribe` function call in a `withFilter` to provide filter condition
282
302
> Note: If a function is provided, it will be called **on subscription start** and must return a serializable object.
283
303
284
304
```ts
285
-
import { withFilter, subscribe } from 'subscriptionless/subscribe';
305
+
import { subscribe } from 'subscriptionless/subscribe';
0 commit comments