Skip to content
Simple java library in order to use GraphQL Subscription on WebSocket based on Apollo Protocol.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
livegql
.gitignore
LICENSE
README.md

README.md

Platform Technology License

This a simple java library in order to use GraphQL Subscription on WebSocket based on Apollo Protocol.

Features

  • connect to a GraphQL server
  • Handle init payload
  • Subscribe/Unsubscribe
  • Close connection
  • Error handling
  • Json handling
  • Manage generic types

Requirements

jdk version >= 1.8

iOS

You'll find the iOS version for this library here: iOS liveGQL

How to install

Gradle

dependency {
  compile 'com.github.billybichon:livegql:1.1'
}

maven

<dependency>
  <groupId>com.github.billybichon</groupId>
  <artifactId>livegql</artifactId>
  <version>1.1</version>
</dependency>

manually

Just copy the livegql-1.1.jar inside your libs folder and be sure to use:

dependency {
  compile fileTree(dir: 'libs', include: ['*.jar'])
}

How to use

Initialize
LiveGQL liveGQL = new LiveGQL("ws://your.url", new LiveGQLListener() {
    // override methods
  }
);
subscription
// subscribe
Subscription subscription = liveGQL.subscribe("query to subscribe", "tag");

// Unsubscribe
liveGQL.unsubscribe(subscription);
close connection
liveGQL.closeConnection();

Dependency

Libraries on which liveGQL depends:

  • Tyrus for managing websocket
  • Gson for handling json object

Bugs

  • Error are not handled but your app won't crash (because it's on the stream ;))
You can’t perform that action at this time.