RPC call for close handler

Hi,

I created a widget with close handler to do some cleaning up when browser is closed.

However, I can’t seem to catch the close event in my connector with RPC call to the server code.

Any idea?


in my widget:
Window.addCloseHandler(new CloseHandler<Window>() {
            @Override
            public void onClose(CloseEvent<Window> event) {
            }
        });

in  my connector:
getWidget().addHandler(new CloseHandler<Window>() {
			@Override
			public void onClose(CloseEvent<Window> event) {
				rpc.cleanMe(event); // it does not run
				
			}
        }, CloseEvent.getType());

Or maybe can someone advise whether this can be done? Have been scratching my head for days. :frowning: