cocos2d/cocos2d-x — pull request #5003 by edwardzhou (2014-01-09 05:52:41+00:00)
Title: fix WebSocket cannot send/receive more than 4096 bytes of data

I have setup a temporary websocket server for yr testing.
And, the write buffer size reduced to 2048. I re-tested 4096 is okay in intranet, but failed on internet. 2048 is the safe size tested.

here is the test case in LUA:

ws = WebSocket:create("ws://118.26.229.45:8000")

ws:registerScriptHandler(function(strData)
print('Websocket Open: ', strData)
local data = ''
for i=1, 2560 do
data = data .. '0123456789abcdef'
end
-- send out 40k string
ws:sendString(data)
end,cc.WEBSOCKET_OPEN)

ws:registerScriptHandler(function(strData)
print('Websocket Message: ', #strData, strData)
end,cc.WEBSOCKET_MESSAGE)