Skip to content

Simple java library in order to use GraphQL Subscription on WebSocket based on Apollo Protocol.

License

Notifications You must be signed in to change notification settings

billybichon/liveGQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 ;))

About

Simple java library in order to use GraphQL Subscription on WebSocket based on Apollo Protocol.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages