Example #1
0
  @Override
  public void onWebSocketClose(final int closeCode, final String message) {

    logger.log(
        Level.INFO,
        "Connection closed with closeCode {0} and message {1}",
        new Object[] {closeCode, message});

    final App app = StructrApp.getInstance(securityContext);

    try (final Tx tx = app.tx()) {

      this.session = null;

      syncController.unregisterClient(this);

      // flush and close open uploads
      for (FileUploadHandler upload : uploads.values()) {

        upload.finish();
      }

      tx.success();
      uploads.clear();

    } catch (FrameworkException fex) {

      logger.log(Level.SEVERE, "Error while closing connection", fex);
    }
  }
Example #2
0
  @Override
  public void onWebSocketConnect(final Session session) {

    logger.log(Level.INFO, "New connection with protocol {0}", session.getProtocolVersion());

    this.session = session;

    syncController.registerClient(this);

    pagePath = request.getQueryString();
  }