GWT:How to make a buffer (FIFO) to hold some 2D array values (coming from server,rpc) at client side?
i am using event-source rpc plugging for data pushi开发者_Python百科ng from server side after a certain period eg. 200ms, so no client request exists, therefore i need a buffer (FIFO) in the client side because server send a lot of data(200ms is very fast) and to display the data in the client side graph (i am using GChart), i need to show it smoothly in the client side and that´s why i need the buffer in client side to hold the data and show the values (x,y)(x1,y1)(x2,y3)....(Xn,Yn)... in the graph in FIFO manner and perform smoothly and also i can dynamically adjust the 200ms delay according to the client performance and sending back an information to server about
Communication between client and server can be written as human conversation as below
Client: slow down mr server i can not handle so much data also my FIFO buffer is full..
Server: ok i am changing my delay time from 200ms to 500ms, but when you have less data to perform please let me know i will chage it again to faster mood that is 200ms.
Client: ok, now send my fast data my buffer is empty.
Thanks in advance Gwt, gchart, event-source
A simple ArrayList won't do? (Used as a buffer, by just appending values and remove first element?)
If this is too slow (too much Java emulation overhead) you could probably create a more java native array, or find some ready made implementation, to work with.
I would start using a simple straight forward ArrayList and see if it works fast enough, and if it turns out to be too slow, I'd look for some faster alternative...
Server-Sent Events (aka EventSource) are one way only: server to client. See this: http://www.html5rocks.com/en/tutorials/eventsource/basics/
In your case you need to send some data back to the server to notify it to send data more slowly (increase delay). Since EventSource is one way only, you'll need an additional connection (GWT-RPC maybe) to notify server to slow down.
精彩评论