Jump to content

MessageServer: "push" messages from server to client (long polling)


Oliver Morsch

Recommended Posts

Hi

 

I test MsgCli Sample,and by Send using AJAX button ,I don't have any problem in standalone and ISAPI .

But

when I send message by Send using UniGuiServer button ,in  standalone I don't have any problem ,but when I convert project to ISAPI,

the browser show : "Could not load SSL library.

Of course I change the following Procedure for using SSL.

procedure TfrmMsgCliCtrl.UniFormCreate(Sender: TObject);
var
  S: String;
begin
  httpPostMsg.HandleRedirects := true;
  httpPostMsg.AllowCookies := true;
  httpPostMsg.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(httpPostMsg);
  httpPostMsg.CookieManager := TIdCookieManager.Create(httpPostMsg);
  with TIdSSLIOHandlerSocketOpenSSL(httpPostMsg.IOHandler) do
  begin
     SSLOptions.RootCertFile := UniServerModule.StartPath + 'root.crt';
     SSLOptions.CertFile := UniServerModule.StartPath + 'cert.cer';
     SSLOptions.KeyFile := UniServerModule.StartPath + 'key.pem';
     OnGetPassword := OnGetPassword;
  end;

  S:='https://MY Addres:8070/';
  Script.Text := StringReplace(Script.Text, '$baseUrl$', S, []);

  edtBaseURL.Text := S;
  edtSessionID.Text := UniSession.SessionID;
  // create objects and init:
  FSL := TStringList.Create;
  FSL.Add('sid=' + edtSessionID.Text);
  FSL.Add('msg=');
end;

procedure TfrmMsgCliCtrl.OnGetPassword(var APassword: string);
begin
  APassword := 'My Password';
end;

Best Regards.

Link to comment
Share on other sites

Hi

 

The session remain open if the close button is not clicked and only the tab or browser closes.

I write below code in the window.close of Ext.window.Window[Window].and check it in OnAjaxEvent .

function window.close(panel, eOpts)
{
  if (confirm("Exit?")) {
    onbeforeunload = null;
    onunload = null;
    ajaxRequest(sender, "CloseThisSession", []);
  };
}


  if SameText(EventName, 'CloseThisSession') then begin
    UniApplication.Terminate;
  end; 

But don't work.

 

 

How to can fix it?

 

 

Best Regards.

Link to comment
Share on other sites

  • 6 months later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...