{"id":"legitatx/mock-messaging-service","name":"mock-messaging-service","scope":"legitatx","platform":"roblox","description":"Fork of IconPippi's MockMessagingService","version":"1.0.0","latest":"1.0.0","versions":["1.0.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"2e367c655f7688051c7f8026f1605eec126c2d7ee24030c20acd4638633a123d","likes":0,"downloads":0,"install":"forest install legitatx/mock-messaging-service","url":"https://forest.dev/p/roblox/legitatx/mock-messaging-service","files":"https://api.forest.dev/ai/package/roblox/legitatx/mock-messaging-service/files","readme":"# MockMessagingService\r\nThis Roblox Studio plugin provides a localhost alternative to the MessagingService Roblox API.\r\nIt is currently impossible to communicate across locally-running Roblox servers on your machine through the provided MS API, unless you were to create a secondary place under the same universe of your main one. This, however did not cover my specific use case and I therefore decided to engineer a hacky alternative.\r\n\r\n## Installation\r\nCopy the `MockMessagingService.rbxm` file to your Roblox Studio plugin folder (`%LOCALAPPDATA%/Roblox/Plugins/MockMessagingService.rbxm` on Windows).\r\n\r\nYou can either download the plugin from the GitHub releases page or build it yourself using Rojo: `rojo build -o MockMessagingService.rbxm`.\r\n\r\n## Usage\r\nIn order to enable your Roblox projects to interact with this mock API you will need to:\r\n - Open a Roblox Studio project of your choice (NOTE: The library will be automatically injected inside of `ServerScriptService`)\r\n - Head to the plugins tab\r\n - Click on the button labeled \"Toggle MMS\" (You might see a WARNING in the console, it's on the TODO list, ignore)\r\n - To invoke the API in your code you will first import it with `local MS = require(game.ServerScriptService.MessagingService)` (Your code will automatically know to use the real MessagingService API when the plugin is disabled or in a producation environment)\r\n - Enjoy MMS!\r\n\r\n## Example\r\nThis code belongs in a server-side script:\r\n```lua\r\nlocal MS = require(game.ServerScriptService.MessagingService)\r\n\r\nMS:SubscribeAsync(\"MMS-Test\", function(data)\r\n\tprint(\"Received data: \" .. data)\r\nend)\r\n```\r\n\r\nThis code can exist in a different locally-running Roblox server instance:\r\n```lua\r\nlocal MS = require(game.ServerScriptService.MessagingService)\r\n\r\nMS:PublishAsync(\"MMS-Test\", \"Hello world!\")\r\n```\r\n\r\nExpected output (in the console of your first script):\r\n```\r\nReceived data: Hello world!\r\n```\r\n\r\n## How it works\r\nMockMessagingService takes advantage of the plugin `settings.json` file. The service writes incoming topic messages in specific setting fiels, and at the same time it listens for any changes to the fields of subscribed topics so it can relay them to the game. Due to this file being shared across all active Roblox Studio instances, data is able to travel across the sandbox boundaries. \r\nCommunication between the plugin and game scripts is achieved through `BindableEvents`.\r\n\r\n## Building and contributing\r\nThis project uses Rojo to manage its structure and perform builds.\r\n\r\nUse this bash command to quickly deploy the plugin in your Roblox Studio environment:\r\n`rojo build -o $LOCALAPPDATA/Roblox/Plugins/MockMessagingService.rbxm`\r\n","readmeTruncated":false}