Author |
Message |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 23/03/2011 18:05:42
|
dromani
jWebSocket Forum Fan
![[Avatar]](/jwsForum219/images/avatar/2723d092b63885e0d7c260cc007e8b9d.png)
Joined: 14/02/2011 19:00:26
Messages: 72
Location: Spain
Offline
|
Very usefull, but I think that it would be better if all classes have their own documentation (javadoc).
|
|
 |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 10/04/2011 13:57:57
|
aschulze
jWebSocket Owner
![[Avatar]](/jwsForum219/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.jpg)
Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline
|
Hi dromani,
you can put objects into a token as well as a list of objects, given that the objects are "tokenizable".
Each object can be serialized into a token by implementing the Tokenizable interface for that object.
And then you can use the putToken method to add the tokenized object into your token.
The same goes for lists of objects. You can create a list, add tokenized objects to that list and add the list to the token via the putList Method.
That easy! If lists are empty the JSON object contains an empty array - no problem. If a value null, a null value is passed - no problem as well.
Best Regards
Alex
|
|
 |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 05/12/2011 11:47:09
|
jense
jWebSocket Forum User
Joined: 05/12/2011 11:06:55
Messages: 2
Offline
|
Hallo,
I am wondering why there is no way to just serialize Objects recursively without need to manually implement ITokenizable?
E.g. com.google.gson does a well job here...
Also, I am wondering why RPC-Objects must implement RPCCallable?
These dependencies and manual implementations make the usage very hard and not suitable in existing settings.
Thanks
Jens
|
|
 |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 16/01/2012 15:15:08
|
Quentin
jWebSocket Forum User
Joined: 22/07/2010 00:01:01
Messages: 37
Location: Paris, France
Offline
|
The idea with ITokenizable was to allow communication with different formats (not only json, but xml, google protobuff or whatever)
The idea behind RPCCallable was to let jwebsocket handle the life cylce of your rpc objects for you.
You should extend objects such as BaseRPCCallable or the other implementation which is connector-scoped.
But you're right, it might not be the best solution, and adding an annotation on the class instead of the "extends thing" is probably a better idea.
Some extra help here :
http://avricot.com/blog/public/jwebsocket/rrpc_article/android%20jwebsocket.html
|
|
 |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 16/01/2012 15:55:51
|
jense
jWebSocket Forum User
Joined: 05/12/2011 11:06:55
Messages: 2
Offline
|
Thanks for your answer, Quentin. We already use many classes for messaging and RPC without any dependency on a framework on these basic classes. We can use jWebsocket as an additional alternative only, if we don't need to touch all these message and RPC classes, even no annotation. To handle the life cylce of RPC objects, you only need an empty constructor.
|
|
 |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 16/01/2012 16:07:00
|
Quentin
jWebSocket Forum User
Joined: 22/07/2010 00:01:01
Messages: 37
Location: Paris, France
Offline
|
Take a look at the BaseConnectorRPCCallable class, the interface allow us to create a unique rpc-instance for each client, that's why I add this interface. http://code.google.com/p/jwebsocket/source/browse/branches/jWebSocket-1.0/jWebSocketPlugIns/jWebSocketRPCPlugIn/src/main/java/org/jwebsocket/plugins/rpc/BaseConnectorRPCCallable.java?r=1758
But it's not a big deal to patch the rpc plugin, you have to change the initRPCCallableClass method and the way you get the instance once it's loaded :
line 305
RPCCallable lInstance = lInstanceGenerator.getInstance(aConnector);
http://code.google.com/p/jwebsocket/source/browse/branches/jWebSocket-1.0/jWebSocketPlugIns/jWebSocketRPCPlugIn/src/main/java/org/jwebsocket/plugins/rpc/RPCPlugIn.java?r=1758
Hope this helps
|
|
 |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 22/04/2012 17:47:12
|
Jerry
jWebSocket Forum Fan
Joined: 05/08/2011 09:49:30
Messages: 59
Offline
|
Hi,
Is there any change in the lastest version ?and how to resolve above issue , I have simular question as well .
Right now my way to resolve this issue, I do not implement the ITokenizable interface. I just use use Json lib to convert my whole object into string and then put my object string into token object by using setstring();
Thanks
Jerry
|
|
 |
![[Post New]](/jwsForum219/templates/default/images/icon_minipost_new.gif) 06/12/2017 10:47:39
|
kate321
jWebSocket Forum User
![[Avatar]](/jwsForum219/images/avatar/3e60e09c222f206c725385f53d7e567c.jpg)
Joined: 06/12/2017 10:41:30
Messages: 3
Offline
|
I was looking for the same problem but thanks I got the answer in comments.
Buy Fencing Direct vouchers & discount codes
|
[URL=http://www.hirelaptops.co.uk/ipad-hire/]iPad Hire/URL] |
|
 |
|