Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Stop RPC calls from being batched, and instead sent immediately
I'm creating a custom widget based on the browser frame with the main goal of sending an event for an iframe changing source from a click in the iframe. I've got it sending events when I want it to and giving me the new url. However, there's one very annoying and probably very easy to solve problem. The rpc calls back to the server are being batched and I'm getting them all at once after like 15-30 seconds. I've tried using flush, but that doesn't seem to really solve it. I've included the connector constructor below.
public MyBrowserFrameConnector() {
registerRpc(MyBrowserFrameClientRpc.class, new MyBrowserFrameClientRpc() {
});
getWidget().addLoadHandler(new MyWidgetLoadHandler() {
@Override
public void onLoad() {
rpc.onLoad(getWidget().getCurrentSource());
getConnection().getServerRpcQueue().flush();
}
});
}
I found this
getConnection().getMessageSender().sendInvocationsToServer();
and it works but it seems a bit heavy of a hammer
Hmm, that's weird. RPC invocations should be immediate unless the method is annotated with @Delayed in the interface.
Yeah I was expecting it to be sent immediately. No Delayed on anything. I one thing I realized was that the batching wasn't for some period of time, but until there was some sort of other server call, then everything was sent over, or at very least all the server side triggers happened at once.