So i wrote this trying to make websocket work with Stable Diffusion API.
I managed to talk to Python side…but lua for me is JUST EVIL.
I tried following addressee
http://127.0.0.1:7860 http://localhost:7860 http://0.0.0.0:7860
an
and even with post link /sdapi/v1/txt2img
in combination of above didn’t get any results
local ws = nil
-- Just for to remmber txt2img post url http://127.0.0.1:7860/sdapi/v1/txt2img
function init(plugin)
-- Create a new dialog
local dlg = Dialog("Send Data")
-- Add a button to the dialog
dlg:button{
id = "send_button",
text = "Senddddddddddddddd",
onclick = function()
if not ws then
ws = WebSocket{
url = "http://0.0.0.0:7860",
onreceive = function(mt, data)
if mt == WebSocketMessageType.PING then
print("Connection open. Sending data...")
elseif mt == WebSocketMessageType.TEXT then
print("Message received: " .. data)
elseif mt == WebSocketMessageType.CLOSE then
print("Connection closed")
elseif mt == WebSocketMessageType.OPEN then
ws:sendText("Hello, Aseprite!")
print("Connection Eror")
end
end,
deflate = false
}
end
-- Attempt to connect and send the data
ws:connect()
ws = nil
end
}
-- Show the dialog
dlg:show{ wait = false }
end
function exit(plugin)
end