GithubHelp home page GithubHelp logo

Comments (3)

boorik avatar boorik commented on June 19, 2024

Which openfl version are you using?
I'm currently working on an issue with latest versions.
Can you publish a sample of code I can compile to figure out what's going on?

from smartfox-haxe-client.

flashultra avatar flashultra commented on June 19, 2024

I also use the latest version of Openfl. I sent obejct to Smartfox server and after that return the result as SFSObject . I found the problem. Just in Smartfox javascript api DefaultSFSDataSerializer. wasn't exposed . To do that you should change js file and add SFSDataSerializer there. Here is a sample function which I use for test:

	public function TestSFSDataSerializer():Void 
	{
		var sfso:ISFSObject = new SFSObject();
		sfso.putLong("tm", Date.now().getTime());
                sfso.putUtfString("data", "TEST");
		var objSfs:ByteArray = DefaultSFSDataSerializer.instance.object2binary(sfso);
		 
		var dSfso : ISFSObject = DefaultSFSDataSerializer.instance.binary2object(objSfs);
		 
		trace("Time: " + dSfso.getLong("tm"));
		trace("Data: " + dSfso.getUtfString("data"));
	}

One more thing. For SFSObect extern all Long calls ( getLong, putLong, getLongArray putLongArray ) should be a Float ? Maybe same is valid for SFSArray class ?

P.S. The function above is for HTML5 target , but will require change in Smartfox JS client and adding externs in DefaultSFSDataSerializer which I did for my project, but probably won't work in yours.

from smartfox-haxe-client.

boorik avatar boorik commented on June 19, 2024

You can try the fix with this code :

		var sfso:ISFSObject = new SFSObject();
		var t:Float = Date.now().getTime();
		trace("time before serialization:"+t);
		sfso.putLong("tm",t );
                sfso.putUtfString("data", "TEST");
		var objSfs:openfl.utils.ByteArray = DefaultSFSDataSerializer.getInstance().object2binary(sfso); 
		var dSfso : ISFSObject = DefaultSFSDataSerializer.getInstance().binary2object(objSfs);
		trace("Time: " + dSfso.getLong("tm"));
		trace("Data: " + dSfso.getUtfString("data"));

from smartfox-haxe-client.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.