oncloselistener

WebSocket: OnClose() is never called

谁都会走 提交于 2021-02-06 15:24:02
问题 I'm implementing an application with a WebSocket endpoint. Here is some code: @ApplicationScoped @ServerEndpoint(value="/socket", encoders = {MessageEncoder.class, CommandEncoder.class}) public class SocketEndpoint { /** Default-Logger */ private final static Logger LOG = LoggerFactory.getLogger(SocketEndpoint.class); @Inject SessionHandler sessionHandler; @OnOpen public void open(Session session, EndpointConfig config) { LOG.debug("Connected session => '{}' - '{}'", session, config);

mdDialog: catch the onClose event

泄露秘密 提交于 2019-12-23 07:49:43
问题 I'm creating a mailbox in angular. And I would need to save the draft message when the popup to send a message closes. I know there are some alternatives: scope.$on("$destroy", function () { saveMessage() }); and: $mdDialog.show(...).finaly(function(){ saveMessage() }); But both are insufficient: The first is called when the Dialog is already closed. This is due to the requirements unacceptable (there is an iFrame that needs to be open) The second is outside the scope of the controller of the