{"id":32325085,"url":"https://github.com/artcom/gom-client-objc","last_synced_at":"2025-10-23T13:13:44.696Z","repository":{"id":10598000,"uuid":"12812276","full_name":"artcom/gom-client-objc","owner":"artcom","description":"Objective-C GOM Client","archived":true,"fork":false,"pushed_at":"2014-08-08T19:32:43.000Z","size":3300,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-10-20T22:34:05.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/artcom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-09-13T15:05:47.000Z","updated_at":"2023-01-28T10:34:17.000Z","dependencies_parsed_at":"2022-09-17T04:51:03.209Z","dependency_job_id":null,"html_url":"https://github.com/artcom/gom-client-objc","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/artcom/gom-client-objc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artcom%2Fgom-client-objc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artcom%2Fgom-client-objc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artcom%2Fgom-client-objc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artcom%2Fgom-client-objc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artcom","download_url":"https://codeload.github.com/artcom/gom-client-objc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artcom%2Fgom-client-objc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280622603,"owners_count":26362266,"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","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-23T13:13:41.220Z","updated_at":"2025-10-23T13:13:44.688Z","avatar_url":"https://github.com/artcom.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Objective-C GOM Client\n\n[![Version](http://cocoapod-badges.herokuapp.com/v/gom-client-objc/badge.png)](http://cocoadocs.org/docsets/gom-client-objc)\n[![Platform](http://cocoapod-badges.herokuapp.com/p/gom-client-objc/badge.png)](http://cocoadocs.org/docsets/gom-client-objc)\n\n##Requirements\n * [CocoaPods dependency manager](http://cocoapods.org)\n * Xcode 4.5 or later\n\n### Using the GOM client in your app project \n\nTo use the Objective-C GOM client in your project add the line\n\n\u003cpre\u003e\npod \"gom-client-objc\"\n\u003c/pre\u003e\n \nto your Podfile and install all necessary dependencies from the CocoaPods dependency manager.\n\nAll dependencies are defined in the file ```gom-client-objc.podspec```\n\n## Usage\n\n### Initialization\n\n```objective-c\nNSURL *gomURI = [NSURL URLWithString:@\"http://\u003cip-or-name\u003e:\u003cport\u003e\"];\nGOMClient *gomClient = [[GOMClient alloc] initWithGomURI:gomURI delegate:self];\n```\n\nAs soon as the GOMClient object is initialized and completely set up it will communicate its state through the `GOMClientDelegate` protocol method ```- (void)gomClientDidBecomeReady:(GOMClient *)gomClient``` returning a reference of the GOMClient object in question.\n\n#### Errorhandling\n\nErrors that occur during GOM requests are passed to the sender through the completion blocks of the respective methods.\n\nFundamental errors are returned to the delegate through the `GOMClientDelegate` protocol method ```- (void)gomClient:(GOMClient *)gomClient didFailWithError:(NSError *)error```\n\n\n### RESTful operations\n\n* GET/retrieve\n\n    * Attribute retrieval:\n    \n    ```objective-c\n    [gomClient retrieve:@\"/tests/node_1:attribute_1\" completionBlock:^(NSDictionary *response, NSError *error) {\n\n        // Your code here\n        \n    }];\n    ```\n    \n    ```\n    {attribute = {\n        ctime = \"2013-12-29T17:48:52+01:00\";\n        mtime = \"2013-12-29T17:48:52+01:00\";\n        name = \"attribute_1\";\n        node = \"/tests/node_1\";\n        type = string;\n        value = 100;\n    }}\n\n    ```\n    \n    * Retrieve a non-existing attribute:\n    \n    ```\n    NSError Domain=de.artcom.gom-client-objc Code=404 \"not found\"\n    ```\n\n    * Node retrieval:\n  \n    ```objective-c\n    [gomClient retrieve:@\"/tests/node_1\" completionBlock:^(NSDictionary *response, NSError *error) {\n   \n        // Your code here\n\n     }];\n     ```\n\n     ```\n     {node = {\n        ctime = \"2013-12-29T17:49:07+01:00\";\n        entries = (\n            {\n                attribute = {\n                    ctime = \"2013-12-29T17:48:52+01:00\";\n                    mtime = \"2013-12-29T17:48:52+01:00\";\n                    name = \"attribute_1\";\n                    node = \"/tests/node_1\";\n                    type = string;\n                    value = 100;\n                };\n            },\n            {\n                attribute = {\n                    ctime = \"2013-12-29T17:49:00+01:00\";\n                    mtime = \"2013-12-29T17:49:00+01:00\";\n                    name = \"attribute_2\";\n                    node = \"/tests/node_1\";\n                    type = string;\n                    value = 20;\n                };\n            },\n            {\n                attribute = {\n                    ctime = \"2013-12-29T17:49:07+01:00\";\n                    mtime = \"2013-12-29T17:49:07+01:00\";\n                    name = \"attribute_3\";\n                    node = \"/tests/node_1\";\n                    type = string;\n                    value = 50;\n                };\n            }\n        );\n        mtime = \"2013-12-29T17:49:07+01:00\";\n        uri = \"/tests/node_1\";\n    }}\n    ```\n    \n    * Retrieve a non-existing node:\n    \n    ```\n    NSError Domain=de.artcom.gom-client-objc Code=404 \"not found\"\n    ```\n\n* POST/create\n \n    * Create empty node:\n    \n    ```objective-c\n    gomClient create:@\"/tests/node_1/test\" withAttributes:nil completionBlock:^(NSDictionary *response, NSError *error) {\n\n        // Your code here\n\n    }];\n    ```\n    \n    ```\n    {node = {\n        ctime = \"2013-12-29T17:54:16+01:00\";\n        entries = (\n        );\n        mtime = \"2013-12-29T17:54:16+01:00\";\n        uri = \"/tests/node_1/test/75d4fb2d-6b4d-4bc0-9e12-91817f90da1d\";\n    }}\n    ```\n\n    * Create node with attributes:\n    \n    ```objective-c\n    NSDictionary *attributes = @{@\"attribute1\": @\"value1\", @\"attribute2\" : @\"value2\", @\"attribute3\" : @\"value3\"};\n    gomClient create:@\"/tests/node_1/test\" withAttributes:attributes completionBlock:^(NSDictionary *response, NSError *error) {\n\n        // Your code here\n\n    }];\n    ```\n    \n    ```\n    {node = {\n        ctime = \"2013-12-29T17:56:04+01:00\";\n        entries = (\n            {\n                attribute = {\n                    ctime = \"2013-12-29T17:56:04+01:00\";\n                    mtime = \"2013-12-29T17:56:04+01:00\";\n                    name = attribute1;\n                    node = \"/tests/node_1/test/b382502c-6732-46ae-bef4-31d9d77ad97b\";\n                    type = string;\n                    value = value1;\n                };\n            },\n            {\n                attribute = {\n                    ctime = \"2013-12-29T17:56:04+01:00\";\n                    mtime = \"2013-12-29T17:56:04+01:00\";\n                    name = attribute2;\n                    node = \"/tests/node_1/test/b382502c-6732-46ae-bef4-31d9d77ad97b\";\n                    type = string;\n                    value = value2;\n                };\n            },\n            {\n                attribute = {\n                    ctime = \"2013-12-29T17:56:04+01:00\";\n                    mtime = \"2013-12-29T17:56:04+01:00\";\n                    name = attribute3;\n                    node = \"/tests/node_1/test/b382502c-6732-46ae-bef4-31d9d77ad97b\";\n                    type = string;\n                    value = value3;\n                };\n            }\n        );\n        mtime = \"2013-12-29T17:56:04+01:00\";\n        uri = \"/tests/node_1/test/b382502c-6732-46ae-bef4-31d9d77ad97b\";\n    }}\n    ```\n    \n* PUT/update\n \n    * Attribute update:\n    \n    ```objective-c\n    [gomClient updateAttribute:@\"/tests/node_1:attribute_1\" withValue:@\"50\" completionBlock:^(NSDictionary *response, NSError *error) {\n\n        // Your code here\n\n    }];        \n    ```\n    \n    ```\n    {status = 200}\n    ```\n    \n    * Node update:\n    \n    ```objective-c\n    NSDictionary *attributes = @{@\"attribute1\": @\"100\", @\"attribute2\" : @\"200\", @\"attribute3\" : @\"300\"};\n    [gomClient updateNode:@\"/tests/node_1/test/b382502c-6732-46ae-bef4-31d9d77ad97b\" withAttributesValue:attributes completionBlock:^(NSDictionary *response, NSError *error) {\n\n        // Your code here\n\n    }];\n    ```\n    \n    ```\n    {status = 200}\n    ```\n\n* DELETE/destroy\n\n    * Destroy existing attribute:\n    \n    ```objective-c\n    [gomClient destroy:@\"/tests/node_1:attribute_3\" completionBlock:^(NSDictionary *response, NSError *error) {\n\n        // Your code here\n\n    }];\n    ```\n    \n    ```\n    {\"success\" = 1}\n    ```\n    \n    * Destroy existing node:\n    \n    ```objective-c\n    [gomClient destroy:@\"/tests/node_1\" completionBlock:^(NSDictionary *response, NSError *error) {\n        \n        // Your code here\n\n    }];\n    ```\n    \n    ```\n    {\"success\" = 1}\n    ```\n    \n    * Destroy non-existing attribute:\n    \n    ```objective-c\n    [gomClient destroy:@\"/tests/node_1:attribute_x\" completionBlock:^(NSDictionary *response, NSError *error) {\n        \n        // Your code here\n        \n    }];\n    ```\n    \n    ```\n    NSError Domain=de.artcom.gom-client-objc Code=404 \"not found\"\n    ```\n    \n    * Destroy non-existing node:\n    \n    ```objective-c\n    [gomClient destroy:@\"/tests/node_x\" completionBlock:^(NSDictionary *response, NSError *error) {\n        \n        // Your code here\n        \n    }];\n    ```\n    \n    ```\n    NSError Domain=de.artcom.gom-client-objc Code=404 \"not found\"\n    ```\n\n### Handling observers\n\n* Register an observer:\n\n    ```objective-c\n    [gomClient registerGOMObserverForPath:@\"/tests/node_1:attribute_2\" clientCallback:^(NSDictionary *dict) {\n\n        // Your code here\n\n    }];\n    ```\n    \n    The first GOM notifcation is received immediately:\n    \n    ```\n    {\n        event_type = \"initial\"\n        path = \"/tests/node_1:attribute_2\"\n        payload = {\n            attribute = {\n                ctime = \"2013-12-29T18:00:27+01:00\";\n                mtime = \"2013-12-29T18:00:27+01:00\";\n                name = \"attribute_2\";\n                node = \"/tests/node_1\";\n                type = string;\n                value = 20;\n            }\n        }\n    }}\n    ```\n\n* Unregister an observer:\n\n    ```objective-c\n   [gomClient unregisterGOMObserverForPath:@\"/tests/node_1:attribute_2\"];\n    ```\n\n### Mapping response dictionaries to data objects\n\nIf the response dictionaries from the GOM are to cumbersome to handle you can use the following classes to map the dictionaries to data objects.\n\n* When receiving an attribute:\n\n    ```objective-c\n    GOMAttribute *attribute = [GOMAttribute attributeFromDictionary:response];\n    ```\n\n* When receiving a node:\n    \n    ```objective-c\n    GOMNode *node = [GOMNode nodeFromDictionary:response];\n    ```\n\n### Handling websocket reconnects\n\nIf the gom client's websocket fails it sends the delegate the message ```- (BOOL)gomClientShouldReconnect:(GOMClient *)gomClient```. Return `YES` to reconnect. You can also trigger the reconnect later by calling ```- (void)reconnectWebSocket```.\n\nWhen the gom client reconnects and finds existing bindings it sends the delegate the message ```- (BOOL)gomClient:(GOMClient *)gomClient shouldReRegisterObserverWithBinding:(GOMBinding *)binding```. \n\nReturn `YES` to re-register an observer for the path in question.\nRe-registration will be silent, no initial GNP will be received. Return `NO` to discard the existing binding.\n\nIf the method is not implemented all bindings will be discarded.\n\n\n## Setting up for client development\n\nTo setup the project for GOM client development open the terminal and clone the repo:\n\n\u003cpre\u003e\n$ git clone https://github.com/artcom/gom-client-objc.git\n\u003c/pre\u003e\n\nand install all necessary dependencies from the CocoaPods dependency manager:\n\n\u003cpre\u003e\n$ cd demo-projects/gom-client-demo_iOS\n$ pod install\n\u003c/pre\u003e\n\nYou can use the demo app contained in this project to run and test your work.\n\nAll dependencies are defined in the file `Podfile`\n\n## Demo app\nSetting the GOM root address:\n\n![Setting the GOM root](https://github.com/artcom/gom-client-objc/raw/master/documentation/images/screenshots/1_settings.png)\n\nStartup - the demo app offers input fields for GOM node or attriute and a value. Four buttons below represent the commands you can send to the GOM:\n\n * Retrieve\n * Create\n * Update\n * Del(ete)\n\n\nAll responses and GNPs from the GOM will appear in the output field above:\n\n![Startup](https://github.com/artcom/gom-client-objc/raw/master/documentation/images/screenshots/2_entry.png)\n\n\nAccessing a GOM value - just enter the path to the node or attribute and tap 'Retrieve':\n\n![Accessing GOM values](https://github.com/artcom/gom-client-objc/raw/master/documentation/images/screenshots/3_accessing_gom_values.png)\n\nThe response from the GOM will appear in the output field above:\n\n![Retrieving GOM values](https://github.com/artcom/gom-client-objc/raw/master/documentation/images/screenshots/4_retrieving_gom_values.png)\n\n\nAdding an observer - tap 'Manage Observers' to open the observer management view. Enter the path to the node or attribute and tap 'Add Observer':\n\n![Adding a GOM observer](https://github.com/artcom/gom-client-objc/raw/master/documentation/images/screenshots/5_adding_observer.png)\n\n\nList with observers - registered observers will appear in the table above. Each additional observer on the same path will only increase the number of handles, shown as the item 'Handles':\n\n![GOM observer added](https://github.com/artcom/gom-client-objc/raw/master/documentation/images/screenshots/6_added_observer.png)\n\n\nDeleting an observer - just swipe to the left and the 'Delete' button appears:\n\n![Deleting a GOM observer](https://github.com/artcom/gom-client-objc/raw/master/documentation/images/screenshots/7_deleting_observer.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartcom%2Fgom-client-objc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartcom%2Fgom-client-objc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartcom%2Fgom-client-objc/lists"}