Skip to content

Instantly share code, notes, and snippets.

View lukasluecke's full-sized avatar
🧞‍♂️

Lukas Lücke lukasluecke

🧞‍♂️
View GitHub Profile
@lukasluecke
lukasluecke / forwardSubscription.ts
Created February 26, 2021 10:57
Handling Mercure GraphQL subscriptions (from API Platform) in urql
import { SubscriptionForwarder, SubscriptionOperation } from '@urql/core/dist/types/exchanges/subscription';
import { host } from 'config';
import { DocumentNode, FieldNode, Kind, OperationDefinitionNode, parse } from 'graphql';
import { OperationResult } from 'urql';
import { make, toObservable } from 'wonka';
export const forwardSubscription: SubscriptionForwarder = operation => {
return toObservable(createFetchSource(operation));
};
VM
First State
some event -> Second State
Second State

Keybase proof

I hereby claim:

  • I am lukasluecke on github.
  • I am lukas (https://keybase.io/lukas) on keybase.
  • I have a public key whose fingerprint is 3A78 15D0 3E00 1D66 36E8 D474 C150 6B22 BE10 272B

To claim this, I am signing this object: