Saturday, September 24, 2016

Re: Refresh of CellTable via data transmitted via WebSocket delayed

Thanks very much Thomas - that was it. I checked the gwt-websocket, and it is indeed using $entry, while gwt-stomp is not. I altered the code and the problem seems to be resolved. Whew! So happy to have found this solution.

Kay

On Friday, September 23, 2016 at 1:21:42 AM UTC-7, Thomas Broyer wrote:


On Friday, September 23, 2016 at 2:04:19 AM UTC+2, Kay Pac wrote:
I have a somewhat complex problem related to a CellTable that updates based on messages received over a WebSocket connection. The problem is as follows: The table does not update in real-time, even though "setRowData" and redraw* are called in real-time. There is a delay in the row appearing in the CellTable, or rather in the DOM as a table row. I realize that redraw does not actually redraw but sets a flag via HasDataPresenter.redraw, which checked elsewhere. It is often the case that mouse movement causes the row to appear - and I have been able to reproduce this behavior. When I put in a timer firing every 300 milliseconds, its execution also causes the row to appear.

That hints at the callback that calls the setRowData and redraw not being wrapped in $entry().
CellTable defers its DOM update using Scheduler.scheduleFinally(), and "finally commands" (and "entry commands") are processed by $entry().
So, your callback schedules a finally task, but because it's not in $entry() it's not called "at the end of the event loop" as it's expected to; it's actually called at the end of the next event loop that uses $entry(), which is the case for almost anything that GWT does: event handlers, timers, etc.
So: make sure your WebSocket's callback is wrapped in $entry() (this also takes care of the GWT.UncaughtExceptionHandler btw)

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment