3
votes

I'm working on a HTML5 collaborative canvas drawing tool on GAE. Essentially people draw, send their coordinates and their motion to GAE through channel API and then other people receive the updates.

As required by the GAE documentation, I have a function in my javascript code to collect messages received from the server:

socket.onmessage= function (message) {
    var s=message.data;
    //Extract X,Y,motion out of s and Draw(x,y,motion)
};

However, the message data I'm sending are actually x and y coordinates and a string of either ("start"/"drag") in the form of:

x=505.0000457763672&y=111.66667175292969&type=start

I actually have no idea about any of the variables or features in this 'message' class and I wouldn't know to use 'message.data' if I didn't see it in someone else's source code - is this actually documented anywhere? I'd like to be able to use the substring features to effectively extract the 3 values but they don't seem to work with message.data.

Any idea if there are detailed documentations on the full member functions/classes/variables documentation on the message class?

Any input is much appreciated!

1

1 Answers

1
votes

I wouldn't say it's documented WELL, but it is documented in the channels API docs: https://developers.google.com/appengine/docs/python/channel/javascript

It specifically does say the message object has a parameter called 'data'.

You should be able to use javascript substring features just fine, but unless you show your code, no one will be able to help you with that.