hasura-connector
Advanced tools
Comparing version 0.0.1 to 0.0.2
46
index.js
@@ -10,25 +10,27 @@ const {ApolloClient, split, InMemoryCache, HttpLink} = require("apollo-boost"); | ||
const wsLink = process.browser ? new WebSocketLink({ | ||
uri: 'wss://massive-hawk-69.hasura.app/v1/graphql', | ||
options: { | ||
reconnect: true | ||
} | ||
}) : null; | ||
const createClient = (url) => { | ||
const wsLink = process.browser ? new WebSocketLink({ | ||
uri: `ws://${url}/v1/graphql`, | ||
options: { | ||
reconnect: true | ||
} | ||
}) : null; | ||
const httpLink = new HttpLink({ | ||
uri: 'https://massive-hawk-69.hasura.app/v1/graphql', | ||
fetch | ||
}); | ||
const client = new ApolloClient({ | ||
cache, | ||
link: process.browser ? split( | ||
({query}) => { | ||
return true; | ||
}, | ||
wsLink, | ||
httpLink, | ||
) : httpLink, | ||
}); | ||
const httpLink = new HttpLink({ | ||
uri: `http://${url}/v1/graphql`, | ||
fetch | ||
}); | ||
console.info(client); | ||
module.exports = client; | ||
return new ApolloClient({ | ||
cache, | ||
link: process.browser ? split( | ||
({query}) => { | ||
return true; | ||
}, | ||
wsLink, | ||
httpLink, | ||
) : httpLink, | ||
}); | ||
} | ||
module.exports = createClient; |
{ | ||
"name": "hasura-connector", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Hasura connect package", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
1141
28