You are here

Server Communication

This object will allow you to communicate directly with a server-side script.  See this forum post for more information.  The SmartBuilder lesson must be located on the same server as the server-side script it is trying to communicate with.  SmartBuilder will wait until it gets a response from the server before continuing.

Important: This means that if SmartBuilder does not receive a response, it will "break" the lesson (it will become unresponsive).

Use the URL Data widget if you wish to communicate across domains and/or do not want your lesson to wait for a response from the server.

This object is often used when an organization doesn't want to use an LMS, but still wants to track learners' progress.

Sample action using the Server Communication object

Here is a sample action that will send an update command with a value being passed along.  Of course, there needs to exist some sort of server-side script that can store this in a database.  Essentially this is the same as entering into the address bar of your browser.

Trigger: Submit Button > onClick
Response: Server Communication > setParameter > "query" = "update"
Response: Server Communication > setParameter > "q1" = "45"
Response: Server Communication > setParameter > "q2" = InputText 1 > getText
Response: Server Communication > sendToURL > ""

Note: Another name value pair is appended at the end of the url.  This is "&rand=1111111111111", where the string of 1s is a randomly generated number.  This is to prevent caching and the same value being ignored if sent multiple times.  Your server-side script should allow for this value to be received, but it can disregard it (basically, just make sure that your script can handle this extra data without breaking).

The postToURL method is used in SmartBuilder the same way as sendToURL method.  However, there are these differences:

  • sendToURL uses the GET form submission method (appends the data to the URL that is called).  This means that the data is less secure, but easier to manipulate.
  • postToURL uses the POST form submission method (sends the data in the message body of the HTTP request).  This means the data is more secure and more data can be sent, but it is generally more difficult to create a server-side script to make use of this data.

To learn more about the differences between these methods, please refer to this external resource -