{"id":19154665,"url":"https://github.com/paulnonatomic/messageservice","last_synced_at":"2026-06-11T21:35:04.906Z","repository":{"id":222101974,"uuid":"756092576","full_name":"PaulNonatomic/MessageService","owner":"PaulNonatomic","description":"A simple Unity C# messaging system","archived":false,"fork":false,"pushed_at":"2026-03-25T23:46:19.000Z","size":42,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-26T21:54:30.210Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"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/PaulNonatomic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-11T23:21:09.000Z","updated_at":"2026-03-25T23:46:24.000Z","dependencies_parsed_at":"2024-11-09T08:28:39.126Z","dependency_job_id":"9bd634f5-a93f-4c55-96f9-a2d27a5fa787","html_url":"https://github.com/PaulNonatomic/MessageService","commit_stats":null,"previous_names":["paulnonatomic/messageservice"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/PaulNonatomic/MessageService","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulNonatomic%2FMessageService","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulNonatomic%2FMessageService/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulNonatomic%2FMessageService/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulNonatomic%2FMessageService/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaulNonatomic","download_url":"https://codeload.github.com/PaulNonatomic/MessageService/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulNonatomic%2FMessageService/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34219510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"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":"2024-11-09T08:27:50.552Z","updated_at":"2026-06-11T21:35:04.897Z","avatar_url":"https://github.com/PaulNonatomic.png","language":"C#","funding_links":["https://www.buymeacoffee.com/nonatomic"],"categories":[],"sub_categories":[],"readme":"# MessageService\n\n## Overview\nMessageService is a simple message passing system for decoupling components in a Unity application. It provides a mechanism for subscribing to messages of a specific type and publishing messages to all interested subscribers.\n\n## Installation\nTo install MessageService in your Unity project, add the package from the git URL: `https://github.com/PaulNonatomic/MessageService.git` using the Unity package manager.\n\n## Support\nIf you like my work then please consider showing your support by buying me a brew\n\u003cbr\u003e\u003cbr\u003e\n\u003ca href=\"https://www.buymeacoffee.com/nonatomic\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-green.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n## Features\n- **Subscribe to Messages**: Listen for specific message types.\n- **Unsubscribe from Messages**: Stop listening for specific message types.\n- **Publish Messages**: Send messages to all subscribers of that message type.\n- **Automatically unsubscribe**: After receiving a message once with SubscribeOnce feature\n\n## Usage\n### Creating Messages\nMessages can be any type, struct or class, depending on your needs.  \n**Structs** are often preferred because they are value types, can be more efficient in some scenarios, and have well-defined copy semantics.  \n**Classes** might be a better choice if your message needs reference semantics, inheritance, or more complex structures.\n\n```csharp\npublic struct MyMessage\n{\n    public string Content;\n}\n```\n\n### Subscribing to a Message\nTo subscribe to a message type, use the `Subscribe\u003cT\u003e` method where `T` is your message type:\n\n```csharp\n_messageService.Subscribe\u003cMyMessage\u003e(HandleMyMessage);\n\nprivate void HandleMyMessage(MyMessage message)\n{\n    // Handle the message\n}\n```\n\n### Unsubscribing from a Message\nTo unsubscribe, use the Unsubscribe\u003cT\u003e method:\n\n```csharp\n_messageService.Unsubscribe\u003cMyMessage\u003e(HandleMyMessage);\n```\n\n### Publishing a Message\nTo publish a message, use the Publish\u003cT\u003e method:\n\n```csharp\n_messageService.Publish(new MyMessage { Content = \"Hello, world!\" });\n```\n\nOptionally pass a publisher object to the Publish method for debugging purposes and potential future tooling:\n```csharp\n_messageService.Publish(new MyMessage { Content = \"Hello, world!\" }, publisher: this);\n```\n\n### Subscribe Once\nMessages can be subscribed to be received only once using SubscribeOnce. After the message is received for the first time, the handler is automatically unsubscribed.\n\n```csharp\n_messageService.SubscribeOnce\u003cMyMessage\u003e(HandleMyMessage);\n```\n## Contributing\nContributions to MessageService are welcome! Please refer to CONTRIBUTING.md for guidelines on contributing to the project.\n\n## License\nMessageService is licensed under the MIT license. See LICENSE for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulnonatomic%2Fmessageservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulnonatomic%2Fmessageservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulnonatomic%2Fmessageservice/lists"}