Skip to content
Jade Meskill edited this page Mar 31, 2016 · 5 revisions

A Protocol Adapter translates between a specific Protocol and Meshblu Core.

Protocol Adapter must follow the request/response pattern. Each request must include a unique responseId. The protocol adapter must wait for the response to be provided by Meshblu Core before sending a response to the Client.

Example Pseudo-code

# curl -X GET https://meshblu-http.octoblu.com/status

app.get '/status', (req, res) =>
  jobRequest =
    metadata:
      jobType: 'GetStatus'

  # Job Manager will submit the request to the job queue and block until
  # the response is generated by Meshblu Core
  @jobManager.do 'request', 'response', jobRequest, (error, jobResponse) =>
    res.status(jobResponse.metadata.code).send(JSON.parse jobResponse.rawData)

# jobRequest =
#   metadata:
#     code: 204
#   rawData: '{"online":true}'

Protocol Adapter Implementations