Fix swshop breaking with other websockets

w.lua does not like websockets not opened with w.lua. this fixes that. this should fix not being able to use cloudcatcher/chatbox and operate the shop at the same time.
This commit is contained in:
Kan18
2019-07-18 16:43:56 -04:00
committed by GitHub
parent da00b5149f
commit 89a6c19bdf

View File

@@ -71,14 +71,14 @@ function init(jua)
jua = jua
if async then
jua.on("websocket_success", function(event, url, handle)
local id = findID(url)
local success, id = pcall(findID,url)
if id and callbackRegistry[id] and callbackRegistry[id].success then
callbackRegistry[id].success(id, handle)
end
end)
jua.on("websocket_failure", function(event, url)
local id = findID(url)
local success, id = pcall(findID,url)
if id and callbackRegistry[id] and callbackRegistry[id].failure then
callbackRegistry[id].failure(id)
end
@@ -86,14 +86,14 @@ function init(jua)
end)
jua.on("websocket_message", function(event, url, data)
local id = findID(url)
local success, id = pcall(findID,url)
if id and callbackRegistry[id] and callbackRegistry[id].message then
callbackRegistry[id].message(id, data)
end
end)
jua.on("websocket_closed", function(event, url)
local id = findID(url)
local success, id = pcall(findID,url)
if id and callbackRegistry[id] and callbackRegistry[id].closed then
callbackRegistry[id].closed(id)
end
@@ -132,4 +132,4 @@ end
return {
open = open,
init = init
}
}