{"id":"sayhisam1/ropost","name":"ropost","scope":"sayhisam1","platform":"roblox","description":"Simple networking abstraction for Roblox. Based on postal.js","version":"1.1.0","latest":"1.1.0","versions":["1.0.0","1.0.1","1.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"251774645536423d131b1447f60557c80d21ebd16846cef3fa63c70cf77adda0","likes":0,"downloads":0,"install":"forest install sayhisam1/ropost","url":"https://forest.dev/p/roblox/sayhisam1/ropost","files":"https://api.forest.dev/ai/package/roblox/sayhisam1/ropost/files","readme":"# Ropost\nA Roblox lua implementation of postal.js (https://github.com/postaljs/postal.js)\nThe goal is to simplify client-server communication into a publish/subscribe model.\nNo more worrying about individual remote events!\n\n# Usage\n\nSee postal.js for reference (https://github.com/postaljs/postal.js)\nOr see the source code for documented api\n\nThe core API is very simple:\n```lua\n    -- subscribes to a specific channel and topic\n    -- call disconnector() to unsubscribe from the channel and topic\n    local disconnector = Ropost.subscribe({\n        channel = \"foo\", \n        topic = \"bar\", \n        callback = function(data, envelope)\n            -- data is a table containing stuff passed by the publisher; \n            -- envelope contains metadata (see below for details)\n            print(\"this is some callback\")\n        end})\n\n    -- publishes to a channel and topic\n    Ropost.publish({\n        channel = \"foo\", \n        topic = \"bar\",\n        data = {\n            baz = \"something\",\n            qux = 1337\n        }\n    })\n```\nFor ease of use, the API also includes a \"channel\" object that removes the need to specify a channel:\n```lua\n    local channel = Ropost.channel(\"foo\")\n    channel:publish(\"bar\", {\n        baz = \"something\",\n        qux = 1337\n    })\n\n    local disconnector = channel:subscribe(\"bar\", function(data, envelope)\n        print(\"this is some callback\")\n    end})\n\n    -- unsubscribes all subscribed callbacks\n    channel:destroy()\n```\n","readmeTruncated":false}