LA1TV / Hyperdeck-Node-Controller

A hyperdeck controller for control over a web interface to fully utilise the hyperdeck API
6 stars 1 forks source link

Created ResponseHandler, renamed RequestHandler to Hyperdeck, Parser no longer asynchronous #4

Closed tjenkinson closed 8 years ago

tjenkinson commented 8 years ago

There are TODO's in a few places. Was only going to make a few tweaks then got carried away sorry :P

The parser now just parses the string from the hyperdeck and returns the nice object. It returns the "type" which is either "synchronousFailure", "synchronousSuccess", or "asynchronous", and the data.

The new ResponseHandler listens on the socket and handles everything coming in. It first parses what it gets with the Parser, then will fire synchronousResponse or asynchronousResponse. For synchronousResponse's the payload is an object of {success: << true if success response code >>, data: << the parsed data object >>}, and asynchronousResponse is just the data from the parser.

The notifier in Hyperdeck will emit asynchronousEvent with the parsed data as the payload for any asynchronous events from the hyperdeck.