wiki:WikiStart/OngoingWork/WebService

Version 1 (modified by stpl01, 5 years ago) (diff)

--

Protocol

  • JSON
    • or BSON (Binary JSON, only a few libs)
  • request based
  • socket or http?
    • http has requests included
    • Sockets don't need a webserver running
      • websocket or plain socket?
        • websocket protocol implemented in browser
        • socket don't need a websocket library

requests

  • running tasks
  • input port types
  • output port types
  • single port data (by task/port_name)

Ruby

  • gem Yail-ruby promising JSON parser
    • sending via socket, websocket possible and tested (only JSON decode on socket untested)
    • parser can handle nested types
    • needs a serializer function for types which creates (nestes) hashes
    • example:
      class Types::Base::Vector3d
        def to_json(*a)
          {
            'json_class'   => self.class.name,
            'data'         => [ :x => x(), :y => y(), :z => z() ]
          }.to_json(*a)
        end
      end
      
      class Types::Base::Samples::RigidBodyState
        def to_json(*a)
          {
            'json_class'   => self.class.name,
            'data'         => [ 
                                :time => time, 
                                :sourceFrame => sourceFrame, 
                                :targetFrame => targetFrame, 
                                :position => position,
                                #:cov_position => cov_position,
                                :orientation => orientation,
                                :velocity => velocity,
                                :angular_velocity => angular_velocity
                                ]
          }.to_json(*a)
        end
      end
      

Browser

  • websocket preferred
  • JSON parser integrated (no external .js lib)
  • jQuery UI looks like a nice UI lib

generic interface

  • socket, but no UI tools