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:
10
swshop/w.lua
10
swshop/w.lua
@@ -71,14 +71,14 @@ function init(jua)
|
|||||||
jua = jua
|
jua = jua
|
||||||
if async then
|
if async then
|
||||||
jua.on("websocket_success", function(event, url, handle)
|
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
|
if id and callbackRegistry[id] and callbackRegistry[id].success then
|
||||||
callbackRegistry[id].success(id, handle)
|
callbackRegistry[id].success(id, handle)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
jua.on("websocket_failure", function(event, url)
|
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
|
if id and callbackRegistry[id] and callbackRegistry[id].failure then
|
||||||
callbackRegistry[id].failure(id)
|
callbackRegistry[id].failure(id)
|
||||||
end
|
end
|
||||||
@@ -86,14 +86,14 @@ function init(jua)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
jua.on("websocket_message", function(event, url, data)
|
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
|
if id and callbackRegistry[id] and callbackRegistry[id].message then
|
||||||
callbackRegistry[id].message(id, data)
|
callbackRegistry[id].message(id, data)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
jua.on("websocket_closed", function(event, url)
|
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
|
if id and callbackRegistry[id] and callbackRegistry[id].closed then
|
||||||
callbackRegistry[id].closed(id)
|
callbackRegistry[id].closed(id)
|
||||||
end
|
end
|
||||||
@@ -132,4 +132,4 @@ end
|
|||||||
return {
|
return {
|
||||||
open = open,
|
open = open,
|
||||||
init = init
|
init = init
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user