Created
January 20, 2017 01:08
-
-
Save rlemon/08fc4b3f24c24398b47eb29b81d869ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a domain socket to interface with for data. | |
I send it a command, it does its thing and sends back data. | |
it also sends data I asked it to send when it changes. | |
I don't know when this is coming in. I've got the service to decorate the data with a prefix depending on where it is triggered by. | |
if the incoming data is triggered by a read request I get a string with 'r:tag:value', if it is a listener I get 'l:tag:value' and a write is as you can imagine 'w:tag:value' | |
I can also get multiple values seperated by a semicolon... but that's easy enough to handle. | |
so right now I create a callbackqueue and when the requests are made on my end I store the tags in my callbackqueue. | |
when I recive read returns from the service with that tag I call the callback and send the new data it returns. | |
.. there is no actuall guarentee the callback will be called.. | |
because I have no promise from the service for a response, although I should be able to expect it. | |
when reading about observables I figure i can take away the callback approach and assign some objects to each tag and have their properies update with the returned values... thus executing a state change. | |
I'm also like 4 beers in. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment