Oliver Morsch Posted June 16, 2013 Share Posted June 16, 2013 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.RegardsOliver MsgSrv.zip 8 Quote Link to comment Share on other sites More sharing options...
albertovesx Posted June 16, 2013 Share Posted June 16, 2013 Very interesting. I am going to try it. Quote Link to comment Share on other sites More sharing options...
asapltda Posted May 26, 2014 Share Posted May 26, 2014 Hello with delphi x2 professional also works Quote Link to comment Share on other sites More sharing options...
RobYost Posted January 25, 2018 Share Posted January 25, 2018 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. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted January 26, 2018 Author Share Posted January 26, 2018 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. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 18, 2018 Author Share Posted February 18, 2018 Here is a new version using UTF-8 encoding (-> no problem with special characters): !MsgSrvV2.zip Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 19, 2018 Share Posted February 19, 2018 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. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 19, 2018 Author Share Posted February 19, 2018 What is in "edtBaseURL.Text", ends it with a "/"? Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 19, 2018 Share Posted February 19, 2018 What is in "edtBaseURL.Text", ends it with a "/"? I create it. I replace "http://127.0.0.1:8070/"with 'https://My Ip :8070' and then check it. The edtBaseURL.Text value is (https://MyIp :8070/sessions) But I have problem yet. Best Regards. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 19, 2018 Author Share Posted February 19, 2018 Show me the procedure TfrmMsgCliCtrl.UniFormCreate In the code above there is a / missing at the end Should be https://MyIp:8070/ Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 19, 2018 Share Posted February 19, 2018 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; Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 19, 2018 Author Share Posted February 19, 2018 OK there is the "/". Have you changed MsgServer to SSL too? Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 19, 2018 Share Posted February 19, 2018 I replace in one procedure http://localhost with (https://My IP). But now set all of them and send result for you. Best Regards. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 19, 2018 Author Share Posted February 19, 2018 Did you add SSL component to MsgServer? And use cert? Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 19, 2018 Share Posted February 19, 2018 I change all of them,and run on server. Then run client program on the client. But don't fixed. Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 19, 2018 Share Posted February 19, 2018 Did you add SSL component to MsgServer? And use cert? No. How to I do it? Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 19, 2018 Author Share Posted February 19, 2018 You need a TIdServerIOHandlerSSLOpenSSL, must assign the certs and then assign it to the HttpServer. But I have never made this. Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 21, 2018 Share Posted February 21, 2018 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. Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 22, 2018 Share Posted February 22, 2018 Hi Now I have an problem. After send Message from MsgSrv ,The browser SSL sign go to red color. Best Regards. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 22, 2018 Author Share Posted February 22, 2018 Which browser(s)? What will be shown by clicking on the "not secure"? Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 22, 2018 Share Posted February 22, 2018 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. Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 22, 2018 Share Posted February 22, 2018 Firefox showed this Error: Error code: SSL_ERROR_BAD_CERT_DOMAIN But Chrome don't show any error. Best Regards. Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted February 22, 2018 Share Posted February 22, 2018 This Pic is from Chrome. The ufrMsgSrv shows :(I am OK!). Best Regards. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 22, 2018 Author Share Posted February 22, 2018 Do you use a self signed certificate or a trusted? Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted February 23, 2018 Author Share Posted February 23, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.