Jump to content

How to post a message to a session


MOGSY

Recommended Posts

Hi

I would appreciate if one could show how to post a message to a particular session, or invoke a function in a particular session.

I would like to run a function in a session and this happens when I get an external message in the server module.

Thanks

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

  • 6 months later...

Hi

To send message from your UniGui to your window application try this.

try      

     Params := TStringStream.Create('');
      IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1';
      IdHTTP1.Request.CustomHeaders.AddValue('authorization','BASIC your authorization here');
      IdHTTP1.Request.CustomHeaders.AddValue('VersionID',VersionID);
      IdHTTP1.Request.CustomHeaders.AddValue('companyID',aCompanyID);

      Params.WriteString(Body);

      URL := 'http://127.0.0.1:8402/yourAPI';     //your server IP and port and any other arg you want
      IdHTTP1.Request.Method :=  'POST';
      IdHTTP1.Request.Source := Params;
      IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
      res := TStringStream.create('');
      IdHTTP1.ConnectTimeout := 20000;
      IdHTTP1.post(URL,params,res);

finally

  FreeAndNil(Params);
  FreeAndNil(res);
end;

Link to comment
Share on other sites

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