2021-10-08 16:15:33 +08:00
|
|
|
local unpack = table.unpack
|
|
|
|
|
2014-12-31 16:28:14 +08:00
|
|
|
if nil == cc.XMLHttpRequest then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2014-08-04 15:22:07 +08:00
|
|
|
--tip
|
|
|
|
local function deprecatedTip(old_name,new_name)
|
|
|
|
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
|
|
|
|
end
|
|
|
|
|
|
|
|
--functions of WebSocket will be deprecated begin
|
|
|
|
local targetPlatform = CCApplication:getInstance():getTargetPlatform()
|
|
|
|
if (kTargetIphone == targetPlatform) or (kTargetIpad == targetPlatform) or (kTargetAndroid == targetPlatform) or (kTargetWindows == targetPlatform) then
|
|
|
|
local WebSocketDeprecated = { }
|
|
|
|
function WebSocketDeprecated.sendTextMsg(self, string)
|
|
|
|
deprecatedTip("WebSocket:sendTextMsg","WebSocket:sendString")
|
|
|
|
return self:sendString(string)
|
|
|
|
end
|
2014-10-17 14:15:30 +08:00
|
|
|
WebSocket.sendTextMsg = WebSocketDeprecated.sendTextMsg
|
2014-08-04 15:22:07 +08:00
|
|
|
|
|
|
|
function WebSocketDeprecated.sendBinaryMsg(self, table,tablesize)
|
|
|
|
deprecatedTip("WebSocket:sendBinaryMsg","WebSocket:sendString")
|
|
|
|
string.char(unpack(table))
|
|
|
|
return self:sendString(string.char(unpack(table)))
|
|
|
|
end
|
2014-10-17 14:15:30 +08:00
|
|
|
WebSocket.sendBinaryMsg = WebSocketDeprecated.sendBinaryMsg
|
2014-08-04 15:22:07 +08:00
|
|
|
end
|
|
|
|
--functions of WebSocket will be deprecated end
|