APE-Project / APE_Server

Ajax Push Engine : Lightweight HTTP Streaming server. Fully written in C language, it provides best performances, making it the faster Comet server to date. APE now support server-side javascript modules through spidermonkey

Home Page:www.ape-project.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Malformed JSON in multipipeCreate event

adeelraza opened this issue · comments

multipipeCreate event returns a MALFORMED JSON which causes JSON.parse on line 180 of Core.js to fail. It's because after the CHANNEL raw data... if there are other events like JOIN LEFT or DATA, then instead of a comma the json is formed like ....}][{"time":"1289577226","raw":"DATA",.... Notice the ][. There should be a , instead of that.

QUICK FIX
Put this before line 180 to fix it till a proper server side fix is released:

raws = raws.replace(/][/gi,",");

Thanks for the report. luckily I had the same bug yersterday that I can easily reproduce.
This can happen on slow client or huge data for me. Did you experience this bug on same situation ?

Yes. It happens when either there is a lot of activity going on in the channel and huge list of users. So by the time it sends the list of users, there are new messages appended with improper JSON.