Question

is anyone out there who can help me sending an array of bitmaps to SmartFoxServer2X? I know there is a documentation but I am new to programming and I do not get it how to solve this problem. On the client side I use JavaScript and I want to send this array to the server:

 var params = {n1:this.cubes1to20_arr};
    this.sfs.addEventListener(SFS2X.SFSEvent.EXTENSION_RESPONSE, this.onExtensionResponse,this);
    this.sfs.send(new SFS2X.Requests.System.ExtensionRequest("upload_cubes",params));

where like I said this.cubes1to20_arr is an array with 20 bitmaps. When I try to send the request to the server I get the error

> `[INFO] OUTGOING DATA
p: [Object]
    p: [Object]
        n1: [Array]
            19: [Bitmap (name=null)] (Unsupported)
            18: [Bitmap (name=null)] (Unsupported)
            17: [Bitmap (name=null)] (Unsupported)
            16: [Bitmap (name=null)] (Unsupported)
            15: [Bitmap (name=null)] (Unsupported)
            14: [Bitmap (name=null)] (Unsupported)
            13: [Bitmap (name=null)] (Unsupported)
            12: [Bitmap (name=null)] (Unsupported)
            11: [Bitmap (name=null)] (Unsupported)
            10: [Bitmap (name=null)] (Unsupported)
            9: [Bitmap (name=null)] (Unsupported)
            8: [Bitmap (name=null)] (Unsupported)
            7: [Bitmap (name=null)] (Unsupported)
            6: [Bitmap (name=null)] (Unsupported)
            5: [Bitmap (name=null)] (Unsupported)
            4: [Bitmap (name=null)] (Unsupported)
            3: [Bitmap (name=null)] (Unsupported)
            2: [Bitmap (name=null)] (Unsupported)
            1: [Bitmap (name=null)] (Unsupported)
            0: [Bitmap (name=null)] (Unsupported)
    r: -1 (Num)
    c: upload_cubes (Str)
c: 1 (Num)
a: 13 (Num)`

So I think that I have to create a byteArray and than send it to the server. Do you have any idea how can I realize this?

Thank you in advance for helping me!

Was it helpful?

Solution

You probably don't want to do this :)

SFS is for multiplayer functionality, not uploading images. I'd recommend initiating an upload script through a web server as apposed to SFS. In general, you want to keep as much processing power off of the SFS server, and uploading large packets of data is going to require heavier processing.

Is there a way to do it, yes, but using the JavaScript API makes it much harder (and slower). You'd have more luck with C#, Java, or even AS3.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top