User Tools

Site Tools


code:client

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
code:client [2011/07/19 00:45] – tutorial to write Python client pkubanekcode:client [2012/02/08 14:21] rcunniff
Line 1: Line 1:
 ====== Writing clients in Python ====== ====== Writing clients in Python ======
  
-RTS2 provides three external binding, which can be used to interact from clients with the RTS2 environment:+RTS2 provides three external bindings, which can be used by clients to interact with the RTS2 environment:
  
   - RTS2 protocol   - RTS2 protocol
-  - XML/RPC protocl+  - XML/RPC protocol
   - JSON   - JSON
  
-JSON, standing for [[http://json.org|JavaScript Object Notation]], is probably the simplest to use. To demonstrate simplicity of its use:+JSON, standing for [[http://json.org|JavaScript Object Notation]], is probably the simplest to use. To demonstrate the simplicity of its use:
  
 <code python> <code python>
Line 32: Line 32:
 </code> </code>
  
-This code demonstrate how you can write a simple client in Python, which does things similar to C++ client provided in [[http://indilib.org/index.php?title=Developing_INDI_clients|INDI tutorial]]. +This code demonstrates how you can write a simple client in Python, which does things similar to C++ client provided in [[http://indilib.org/index.php?title=Developing_INDI_clients|the INDI tutorial]]. 
-It illustrates extremely simplicity of outside API in JSON (in this case further masked by Python library to use it). After establishing connection, your client is exchanging messages over opened HTTP connection - so you don't pay extra price for opening and closing communication.+It illustrates the extreme simplicity of the external JSON API (in this case further masked by the Python library). After establishing connection, your client communicates via a kept-alive HTTP connection - so you don't pay the extra price for opening and closing communication.
  
-JSON is much more dense then XML, so messages are shorter, and parameters are passed as URL parameters - so you can get response from server using common Internet browser (or wget command), which is handy for debugging.+JSON is much more dense then XML, so messages are shorter, and parameters are passed as URL parameters - you can talk to the server with a web-browser (or wget command), which is handy for debugging.
  
-Errors are propagated as standard Python errors, and as they are not catch, they will terminate client and write its traceback to standard output. If you wish to catch possible errors, all you have to do is to add try-except blocks.+Errors are propagated as standard Python errors, and as they are not caught, they will ordinarily cause a client to terminate with a traceback writen to standard output. If you wish to catch possible errors, all you have to do is to add try-except blocks.
  
-This also provides basic security, as you have to login to serverAnd if you decide to disallow external users to communicate with RTS2you just kill rts2-xmlrpcd, which handles the communication.+This also provides basic security, as login is required To disable external access entirely, just kill rts2-xmlrpcd, which provides the service.
code/client.txt · Last modified: 2012/02/08 00:00 (external edit)