jWebSocket Forum

[Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Streaming JSON  XML
Forum Index » Server side Plug-Ins, Apps, Listeners and Filters
Author Message
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

Hi all, as many i'm new and i have some newbe questions

I want to stream data to as many client as possible, all client will need the same data at each period of time (let say at each second)

Communication is only one way for now, server to clients.

So Streaming Example looks like the best bet.

I start from the TimeStream class and i will modify it to read from my SQL database.

Now here is my 2 questions:

1) Did i create a JSON from my DataSet and simply replace where the time is sent by my JSON string
(it will be something like a JSON inside a JSON) ??

2) Is there a way to compress data sent to clients, i need to send between 5k and 10k of data to clients, times 1000 its become huge (i did not test it yet, just projection)

Any help or suggestion at this point will be very welcome

Thank you

David
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi David,

yes, using the TimeStream as "template" for for your "database-to-client" stream looks perfect.
If you have a look at the time stream you'll see that a Token is created with various fields.

You can simply clone the TimeStream class and add arbitrary further fields to this token, it's really that simple.
If you also have e.g. a "type" or "name" field in your data (which would overwrite the existing values) you could create a HashMap or FastMap and add this Map instance e.g. by lToken.addMap(yourMap); It's automatically converted to JSON within the Token. So you do not have to take care of any transmissions aspects. That simple.

One of the big benefits of the WebSocket protocol is its minimum overhead (compared to http). So you can easily calculate the required bandwidth by adding 2 byte to the size of the JSON packet you are sending: Number of concurrent clients x (datasize + 2). Let's say you have 1000 clients and need to stream 10k per client per second you can roughly calculate the required upstream bandwidth by 1000x10k = 10MB x 8 = 80 MBit.

Kompression is part of the lastet IEFT WebSockets draft #03 but AFAIK not yet supported by any browser. Here will be some more room for future improvements. We will provide it as soon the browsers support compression on WebSockets.

Have fun and let me know if we can further assist you.

Best Regards
Alex

This message was edited 1 time. Last update was at 25/11/2010 11:33:48

[WWW]
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

it sounds good, is there an example of this Map thing?

Also, do you think its possible to use some kind of custom compression and a javascript client decompression tool.

Maybe FlashBridge can support it (hum, not good for already HTML 5 browser)

Maybe a javascript decompression class (just thinking)

aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi David,

compression in WebSockets will be gzip which is pretty effective across various formats.
Of course, you could use your own compression/decompression, but since native decompression in the browser probably will be faster than in JavaScript I would recommend to wait a couple of weeks until it's available. Less work, less expensive and it's standardized

Regards
Alex
[WWW]
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

yes, sure if the time frame is that small!

I have quick question, is this technology is ready for production if i want to use it now for real? (i guess yes, but just to be sure, because it is mark as Beta)

thank you
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi David,

v0.11beta will be released until Nov 17th, v0.12beta end of december and in January we will release our first production version.
Looking forward to obtaining your feedback. BTW: You are kindly invited to have a look at our issue tracker to track the development progress: http://code.google.com/p/jwebsocket/issues/list.

Best Regards
Alex

This message was edited 1 time. Last update was at 11/11/2010 15:30:44

[WWW]
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

nice, so what you say if i go live with beta version? i will not be the first one?
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi David,

we already have thousand's of downloads and you're definitly not the first one who is using it for production.
But build our own picture, just google for jWebSocket feedback.
A nice example you can see here: http://www.youtube.com/watch?v=1wu5gOxQxcs
BTW: Our live server now has not been restarted for more than 2 month w/o any issues.
Anyway, in the next days we'll update it to v0.11 due to the lots of new features.

Best Regards
Alex
[WWW]
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

wow, very nice! what are you using for production server? And do you use a special version or a stand allone version as anybody can download?

My plan is tu use Windows 2008 server R2 x64

install it as a service.

what do you think?
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi David,

up to now its a simple virtual machine running Windows 2003 Server.
We already set up a dedicated Windows 2008 R2 x64 as well and will move it after v011 rollout due to the massively increasing traffic.
I'm pretty sure further machines will become necessary soon

We operate it as a service exactly like you are planning.

Probably we will use Jetty as underlying engine because Jetty already supports SSL and http upgrade for WebSockets so that we can use http and ws on the same port, same for https and wss.

Much "nice to haves" coming...

Alex

This message was edited 1 time. Last update was at 11/11/2010 16:00:21

[WWW]
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

hum, what is Jetty? it is a streaming plugin to?

Wow, there is so many to learn, but it look so nice

sorry for newbe questions

David
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi David,

Jetty is a Servlet Engine with Servlet 3.0 Spec and WebSocket support. From the application perspective you do not need to take care of this, it's absolutely transparent. This is why we have a modular framework with various components communicating via clean APIs

Alex

http://jetty.codehaus.org/jetty/
http://www.eclipse.org/jetty/

This message was edited 1 time. Last update was at 11/11/2010 16:12:18

[WWW]
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

nice job! i will take a look at this.

Thank you
David

jWebSocket Forum User

Joined: 10/11/2010 17:05:47
Messages: 38
Offline

Hi again, Can you point me to the Json map example you mention In previous msg?

Thanks
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Just an example:

[WWW]
 
Forum Index » Server side Plug-Ins, Apps, Listeners and Filters
Go to:   
Powered by JForum 2.1.9 © JForum Team