{"id":15313354,"url":"https://github.com/florianmari/LiveGQL","last_synced_at":"2025-10-08T22:32:08.863Z","repository":{"id":56919884,"uuid":"96425078","full_name":"florianmari/LiveGQL","owner":"florianmari","description":"Use GraphQL Subscriptions on iOS :ok_hand:","archived":true,"fork":false,"pushed_at":"2019-03-13T08:56:31.000Z","size":146,"stargazers_count":83,"open_issues_count":2,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-15T20:21:56.678Z","etag":null,"topics":["graphql","graphql-client","graphql-subscriptions","socketrocket"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/florianmari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-06T11:55:14.000Z","updated_at":"2024-01-19T22:40:47.000Z","dependencies_parsed_at":"2022-08-21T04:20:15.795Z","dependency_job_id":null,"html_url":"https://github.com/florianmari/LiveGQL","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianmari%2FLiveGQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianmari%2FLiveGQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianmari%2FLiveGQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianmari%2FLiveGQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florianmari","download_url":"https://codeload.github.com/florianmari/LiveGQL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235770063,"owners_count":19042373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-client","graphql-subscriptions","socketrocket"],"created_at":"2024-10-01T08:41:26.605Z","updated_at":"2025-10-08T22:32:03.499Z","avatar_url":"https://github.com/florianmari.png","language":"Swift","funding_links":[],"categories":["Libraries"],"sub_categories":["Swift Libraries"],"readme":"![LiveGQL: Use GraphQL Websocket subscription in Swift](http://i.imgur.com/2hFD4w3.png)\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPod](https://img.shields.io/cocoapods/v/LiveGQL.svg)](https://github.com/florianmari/LiveGQL)\n[![GraphQL](https://img.shields.io/badge/Designed%20for-GraphQL-ff69b4.svg)]()\n\nLiveGQL is a simple library to use GraphQL Subscribtion on WebSocket based on [Apollo Protocol](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md).\n\nThe Android version is [here](https://github.com/billybichon/liveGQL)\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Usage](#usage)\n- [What's new?](#news)\n- [Contributors](#contributors)\n\n## Features\n\n- [x] Connect to a GraphQL WebSocket server\n- [x] Send messages\n- [x] Subscribe / unsubscribe\n- [x] Close connection\n- [x] Data handling (delegate)\n- [x] Error handling\n- [x] Reconnect option\n- [x] JSON raw response\n- [x] Queue of unsent messages\n- [x] Implement all Apollo protocol\n- [x] Specify entry protocol\n\n## Requirements\n\n- iOS / tvOS \u003e= 9.0\n- Xcode \u003e= 8.1\n- Swift \u003e= 3.0\n\nWe also use [SocketRocket](https://github.com/facebook/SocketRocket) and [JSONCodable](https://github.com/matthewcheok/JSONCodable), thanks to them\n\n## Communication\n\n- Use issue if you have any problem\n- Don't hesitate to contribute to the project with a pull request\n\n## Installation\n\n### CocoaPods\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'LiveGQL', '~\u003e 2.0.0'\nend\n```\n\n### Carthage\n\n```\ngithub \"florianmari/LiveGQL\"\n```\n\nSee [Carthage guide](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) for more informations about integrating with Carthage.\n\n### Manually\n\nJust copy files in the Source folder!\n\n## Usage\n\n### Initializing\n\nImportant: to not fall out the variable in the scope, please instantiate above your viewDidLoad() for example.\n\n```swift\nimport LiveGQL\n\nlet gql = LiveGQL(socket: \"ws://localhost:7003/feedback\")\n\ngql.delegate = self\ngql.initServer(connectionParams: nil, reconnect: true)\n```\n\nYou can set a Dictionnary[String:String] as connectionParams like for authentification by example.\nThe default protocol is now: graphql-subscriptions, but you can specify yours this way\n\n```swift\nimport LiveGQL\nlet gql = LiveGQL(socket: \"ws://localhost:7003/feedback\", protocol: \"graphql-subscriptions\")\n```\n\n### Subscribe / Unsubscribe\n\n#### Subscribe\n\nJust call subscribe method, set an identifier and your subscription query as well.\n\n```swift\ngql.subscribe(graphql: \"subscription {feedbackAdded {id, text}}\", identifier: \"feed\")\n```\n\nThese parameters are mandatory but you can specify exposed variables and operation names if you want, look at the signature:\n\n```swift\npublic func subscribe(graphql query: String, variables: [String: String]?, operationName: String?, identifier: String) {}\n```\n\n##### Treat server response\n\nYou have to implement delegate method, in your main ViewController (for example) just att that\n\n```swift\noverride func viewDidLoad() {\n        super.viewDidLoad()\n        gql.delegate = self\n        // Do any additional setup after loading the view, typically from a nib.\n    }\n```\n\nBelow your class add the folowing extension and implement the method:\n\n```swift\nextension ViewController: LiveGQLDelegate {\n    func receivedMessage(text: String) {\n        print(\"Received Message: \\(text)\")\n    }\n}\n```\n\n#### Unsubscribe\n\nJust call unsubscribe method and your identifier\n\n```swift\ngql.unsubscribe(identifier: \"feed\")\n```\n\n### Close connection\n\n```swift\ngql.closeConnection()\n```\n\n## What's new?\n\n### 2.0.0\nIn this second version of LiveGQL, we give up Starscream for using SocketRocket from Facebook, as well, the protocol has been fixed and you can specify yours!\n\n## Contributors\n\nI'd like to thanks these people for their contributions:\n\n[@rhishikeshj] for cleaning the code and implement SocketRocket!\n[@duncsand] for adding exposed variables and operationName on subscription call\n[@josefdolezal] for giving us Carthage support!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianmari%2FLiveGQL","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorianmari%2FLiveGQL","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianmari%2FLiveGQL/lists"}