Comments (3)
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.
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.
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)
- Server communication HOT 1
- SFSArray:getBool returning null on iOS (+ suggested fix) HOT 3
- Bluebox HOT 2
- HTML5 support ? HOT 9
- Missing putText(key:String, value:String) in SFSObject
- Property iterator not found on haxe.ds.IntMap HOT 2
- Crash when using encryption (null ByteArray cast)
- Android does not receive CONNECTION_LOST event
- Suggestion: Remove ISFSArray, ISFSObject HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smartfox-haxe-client.