mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Add plugin half of script-only, existing-instance-only, two way sync
This commit is contained in:
parent
e83437c193
commit
cfff08cdfd
4 changed files with 95 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
local Http = require(script.Parent.Parent.Http)
|
||||
local Log = require(script.Parent.Parent.Log)
|
||||
local Promise = require(script.Parent.Parent.Promise)
|
||||
|
||||
local Config = require(script.Parent.Config)
|
||||
|
|
@ -153,6 +154,23 @@ function ApiContext:read(ids)
|
|||
end)
|
||||
end
|
||||
|
||||
function ApiContext:write(patch)
|
||||
local url = ("%s/write"):format(self.__baseUrl)
|
||||
local body = Http.jsonEncode({
|
||||
sessionId = self.__sessionId,
|
||||
patch = patch,
|
||||
})
|
||||
|
||||
return Http.post(url, body)
|
||||
:andThen(rejectFailedRequests)
|
||||
:andThen(Http.Response.json)
|
||||
:andThen(function(body)
|
||||
Log.info("Write response: {:?}", body)
|
||||
|
||||
return body
|
||||
end)
|
||||
end
|
||||
|
||||
function ApiContext:retrieveMessages()
|
||||
local url = ("%s/api/subscribe/%s"):format(self.__baseUrl, self.__messageCursor)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue