Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Add support for MQTT #160

Open
1 of 5 tasks
ccapndave opened this issue Nov 26, 2018 · 1 comment
Open
1 of 5 tasks

Add support for MQTT #160

ccapndave opened this issue Nov 26, 2018 · 1 comment

Comments

@ccapndave
Copy link

Some GraphQL servers (specifically AWS AppSync) use MQTT for the websocket transport protocol, which unfortunally doesn't work with ApolloLinks.webSocketLink. It would be great if reason-apollo could support this link type too.

I believe this is the JS implementation of it: https://raw.githubusercontent.com/awslabs/aws-mobile-appsync-sdk-js/254930e3de1211c20bbac3efadf571008826bc32/packages/aws-appsync/src/link/subscription-handshake-link.js

I actually made an attempt to port this to Reason, but didn't quite manage to get it to work.

Issue Labels

  • has-reproduction
  • feature
  • docs
  • blocking
  • good first issue
@ccapndave
Copy link
Author

ccapndave commented Dec 3, 2018

I found this (very hacky) workaround to use AWP AppSync. First add the aws-appsync package to the project. Then create the client using:

let client = [%bs.raw
  {|
(function() {
  let { AWSAppSyncClient, createAppSyncLink, AUTH_TYPE } = require("aws-appsync");

  return new AWSAppSyncClient(
    {
      url: "your graphql endpoint",
      region: "yourregion",
      auth: {
        type: AUTH_TYPE.API_KEY,
        apiKey: "yourapikey"
      }
    }
  );
})()
|}
];

After this you can use reason-apollo like usual, and subscriptions from AppSync work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant