Jump to content

Recommended Posts

Posted

Hi!

I have developped a message server, so you can send "push" messages at any time from the server to the web client (using long polling). You can also send messages from a client to another client (with message server in the middle).

The message server is a standalone app. You must run MsgSrv.exe and MsgCli.Exe (second is a uniGui project).

I was using Delphi XE3 (with generics, class vars, ...), so i have included the .exe, because the message server does not compile in old delphi versions.

For details see the commented screenshot.

Regards
Oliver
 

post-147-0-22307200-1371351763_thumb.png

MsgSrv.zip

 

  • Upvote 8
  • 11 months later...
  • 3 years later...
Posted

I just found this thread.  When I tried to compile the client with XE6:

 

 

procedure TfrmMsgCliCtrl.btnSelectTargetClick(Sender: TObject);
begin
  frmSelectTargetSession.ShowModal( procedure (Res: Integer)
    begin
      if Res = mrOK then begin
        edtTargetSess.Text := frmSelectTargetSession.lbSessions.Text;
      end;
    end
    );
end;

[dcc32 Error] UfrmMsgCliCtrl.pas(105): E2250 There is no overloaded version of 'ShowModal' that can be called with these arguments

 

Does someone know how to fix the syntax for XE6, or am I doing something wrong?

 

Thanks.

Posted
procedure TfrmMsgCliCtrl.btnSelectTargetClick(Sender: TObject);
begin
  frmSelectTargetSession.ShowModal( procedure (Sender: TComponent; Res: Integer)  // <---
    begin
      if Res = mrOK then begin
        edtTargetSess.Text := frmSelectTargetSession.lbSessions.Text;
      end;
    end
    );
end;

It has nothing to do with XE6, it's a change in UniGUI.

  • 4 weeks later...
Posted

Hi

 

I use SSL protocol in my project.

I change the code

procedure TfrmMsgCliCtrl.UniFormCreate(Sender: TObject);
var
  S: String;
begin
  // init edits and script:
{  S := 'https://' + StringReplace(UniSession.Host,
    IntToStr(UniServerModule.Port), '8070', []);}

  S:='https://my valid IP:8070';
end;

Now in this line the error ocurred

procedure TfrmSelectTargetSession.UniFormShow(Sender: TObject);
var
  S: String;
begin
  S := edtBaseURL.Text + 'sessions';
  S := httpGetSess.Get(S);
end;

I add below code 

  httpGetSess.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(httpGetSess);
  httpGetSess.HandleRedirects := True;

But don't fixed.

 

Best Regards.

post-4571-0-32317900-1519046421_thumb.jpg

Posted


procedure TfrmMsgCliCtrl.UniFormCreate(Sender: TObject);
var
S: String;
begin
// init edits and script:
{ S := 'http://' + StringReplace(UniSession.Host, IntToStr(UniServerModule.Port), '8070', []); //alternative?: S := StringReplace(UniSession.URL, IntToStr(UniServerModule.Port), '8070', []);
if Copy(S, Length(S), 1) <> '/' then
S := S + '/';}
S := 'https://x.x.x.155: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;

 

Posted

HI

 

I could send message from MsgSrv to all client.

procedure TfrmMsgSrvCtrl.FormCreate(Sender: TObject);
var
  LIOHandleSSL: TIdServerIOHandlerSSLOpenSSL;
begin
  FServer := TIdHTTPWebBrokerBridge.Create(Self);
  LIOHandleSSL := TIdServerIOHandlerSSLOpenSSL.Create(FServer);
  LIOHandleSSL.SSLOptions.CertFile := 'cert.cer';
  LIOHandleSSL.SSLOptions.RootCertFile := 'root.crt';
  LIOHandleSSL.SSLOptions.KeyFile := 'key.pem';
  LIOHandleSSL.OnGetPassword := OnGetSSLPassword;
  FServer.IOHandler := LIOHandleSSL;
  FCounter := 1000;
end;
procedure TfrmMsgSrvCtrl.OnGetSSLPassword(var APassword: String);
begin
  APassword := 'The Pass';
end;
Of course  must change  all URL  to URL := Format('https://X.X.X.X:%s/........
 

 

 And now I try to  solve send message from MsgCli to all session.

 

 

Best Regards.

Posted

 

 

Which browser(s)?

 

In Chrome,Because in Firefox I can't recive any message and  ufrMsgSrv  show :(You'r connection is not secure).

 

 

What will be shown by clicking on the "not secure"?

I showed it by picture that attached.

post-4571-0-71917600-1519337033_thumb.jpg

post-4571-0-44770100-1519337203_thumb.jpg

Posted

Now I have tested SSL and it works. But Chrome and Firefox show "(certificate) not secure" because of self signed certificate. IE and Edge have no problem after adding the root certificate.

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...