OpenAjaxPublishSync  | 
     
  DEVELOPER  | 
  ![]()  | 
OpenAjaxPublishSync
| 
   
  | 
  
   
  | 
| 
   Purpose  | 
  
   .OpenAjaxPublishSync Client method publishes messages to the OpenAjax Hub in the Open Client browser. Subscribers to the message as defined in the $topic parameter receive the message payload as contained in the $data parameter. If the kernel tries to call the method when connected to an older Open Client, a rollback run-time error occurs and the current function terminates. Note: When using the OpenAjaxPublishSync Client method, the kernel waits for a response from the method before continuing and a value is returned in the $return parameter. Click here for more information about the OpenAjax Hub.  | 
| 
   Object Type  | 
  
   Client  | 
| 
   Syntax  | 
  
   variable=Client.OpenAjaxPublishSync ($topic, $data, $return)  | 
| 
   Operation  | 
  
   variable is a numeric variable that captures the return code. $topic defines a message in the OpenAjax Hub. $data contains the message payload that is sent to subscribers of the $topic parameter in the hub. The maximum payload length is 2000 bytes. $return accepts the return string from the Client.  | 
| 
   Remarks  | 
  
   If using this feature, it is recommended that the TP_ROLLBACK setting is set to 'Y' in the pro4v[n].ini file.  | 
| 
   Example  | 
  
   The following is an example that demonstrates OpenAjaxPublishSync: $topic = “Weather�? $data = "{'town': 'Luton', 'TempMin': '4C', 'TempMax':'11C', 'Outlook':'Rain & Wind', 'WindSpeedMax':'35mph', 'Tomorrow': 'Sunny'}" 
 Client.OpenAjaxPublishSync($topic, $data, $Result) 
 The html document below shows the contents of a Template page (the Template page defined in an Open Client Session Definition) that subscribe to and handle the published event from the logic example. Example Template Page <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> </head> <body> <div id="proiv_panel"> </div> <script language="javascript"> OpenAjax.hub.subscribe("Weather ", function(event, obj){ obj.returnValue = "Weather received.�? }); </script> </body> </html> If you then publish the weather using 'sync' method the “Weather received.�? message is the $result parameter. 
 
 
 
  | 
![]()  | 
 
  Note: This method applies to PROIV Open Client only.  | 
Topic ID: 510173










  
