by toby » Thu 30 Apr 2015 02:37
Virtually anything you do involves sending data to the server,
so you just need the appropriate message.
Here's one approach:
It may or may not be the best way, but it's the first thing that came to mind.
For a model you can use the Union Chat Room example.
Just replace the chat that's sent with your image data.
You'll need a module to receive the data.
It can either be a server module, or a room module.
This example uses a room module, but a server module example would be similar.
From the client side, use something like this:
msgManager.sendUPC(UPC.SEND_ROOMMODULE_MESSAGE, roomID, "image-data", "thedata|"+imagedata);
(A server module message will be similar.)
Now that straightforward call might need some preparation for a couple of reasons.
- Image data is probably binary, so you might want to convert it to some text-form representation,
such as hexadecimal or base-64 encoding.
- Image data can be be large (as in megabytes, etc) so you might want to break it up into parts.
Just add more arguments:
msgManager.sendUPC(UPC.SEND_ROOMMODULE_MESSAGE, roomID, "image-data", "part-number|" + p + " of " + n, "thedata|" + imagedata);
Then you need to write the receiving code in the module on the server side
which decides what to do with the image once it has it.