{"id":25933101,"url":"https://github.com/roam-ai/roam-go","last_synced_at":"2025-03-04T00:52:09.295Z","repository":{"id":57565297,"uuid":"328986066","full_name":"roam-ai/roam-go","owner":"roam-ai","description":"Go Pub/Sub Library; GoLang library to subscribe to realtime location updates from Roam.ai's location SDKs.","archived":false,"fork":false,"pushed_at":"2021-02-09T12:07:29.000Z","size":8,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T05:15:30.002Z","etag":null,"topics":["golang-library","listen","location-sdk","pubsub","roam","sdk","subscription"],"latest_commit_sha":null,"homepage":"https://roam.ai","language":"Go","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/roam-ai.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":"2021-01-12T12:52:38.000Z","updated_at":"2022-12-02T16:43:11.000Z","dependencies_parsed_at":"2022-09-03T12:20:32.210Z","dependency_job_id":null,"html_url":"https://github.com/roam-ai/roam-go","commit_stats":null,"previous_names":["geosparks/roam-go"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roam-ai%2Froam-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roam-ai%2Froam-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roam-ai%2Froam-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roam-ai%2Froam-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roam-ai","download_url":"https://codeload.github.com/roam-ai/roam-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763740,"owners_count":20016162,"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":["golang-library","listen","location-sdk","pubsub","roam","sdk","subscription"],"created_at":"2025-03-04T00:52:08.719Z","updated_at":"2025-03-04T00:52:09.288Z","avatar_url":"https://github.com/roam-ai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# roam-go\nA Golang backend library for GeoSpark Location Subscription. It is used to subscribe to user's locations at project level or location of a single user.\n\nroam-go supports subscription to the following location data:\n* Specific user\n* All users of a group\n* All users of project\n\n## Installation\nYou can install our Golang library as mentioned below.\n```\ngo get -u github.com/roam-ai/roam-go/roam\n```\n\n## Example Usage\nYou can think this library as a wrapper around our REST API which needs your API key for authorization and it works as per project level. It is fairly simple to use:\n- Create an instance of subscription with your API key. \n- Define your custom callback function and pass it with Subscribe method, which will be executed on every location received from the server.\n- To stop receiving data, call Unsubscribe method.\nThe below example usage code:\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/roam-ai/roam-go/roam\"\n\t\"time\"\n)\nfunc main() {\n    // initialization\n    subscription , _ := roam.NewProjectSubscription(\"apikey\")\n\n    var handler roam.MessageHandler = func(userID string , payload []byte){\n        fmt.Println(userID)\n        fmt.Println(string(payload))\n\t}\n\n    subscription.Subscribe(handler)\n}\n```\n\n### Subscribe to a single user\nYou can use the SDK to subscribe to single user's location and listen to it. You have pass the user id which our Mobile SDK's returns during creating a user.\n\n```\nuserSubscription , err := roam.NewUserSubscription(\"apikey\",\"userID\")\n```\n#### Example Usage\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/roam-ai/roam-go/roam\"\n\t\"time\"\n)\nfunc main() {\n    // initialization\n    subscription , _ := roam.NewUserSubscription(\"apikey\",\"userID\")\n\n    // Declaring handler function\n    var handler roam.MessageHandler = func(userID string , payload []byte){\n        // logic\n\t}\n\n    // start subscription\n    subscription.Subscribe(handler)\n}\n```\n\n### Subscribe to a group:\nYou can also use the SDK to subscribe to a user group and listen to their location updates. \nYou can get the group_id from our developer API for user grouping and use the group id when creating the client instance to listen to location at user group level.\n\n```\ngroupSubscription , err := roam.NewGroupSubscription(\"apikey\",\"groupID\")\n```\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/roam-ai/roam-go/roam\"\n\t\"time\"\n)\nfunc main() {\n    // initialization\n    subscription , _ := roam.NewGroupSubscription(\"apikey\",\"groupID\")\n\n    // Declaring handler function\n    var handler roam.MessageHandler = func(userID string , payload []byte){\n        // logic\n\t}\n\n    // start subscription\n    subscription.Subscribe(handler)\n}\n```\n\n### Unsubscribe\nAt any point, if you wish to unsubscribe from location updates, use the below code:\n```\nsubscription.Unsubscribe()\n```\n\n### Handler Function\nWhile calling Subscribe method on subscription, you will need to pass a handler func as parameter.\nHandler func should have userID of type string and payload of type []byte and will be invoked on every location update received.\n```\n    var handler roam.MessageHandler = func(userID string , payload []byte){\n        // logic\n\t}\n\n    subscription.Subscribe(handler)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froam-ai%2Froam-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froam-ai%2Froam-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froam-ai%2Froam-go/lists"}