Skip to content

Conversation

@mm-gmbd
Copy link
Contributor

@mm-gmbd mm-gmbd commented May 4, 2017

  • Added four middleware functions:
  • beforeOnAck - gets called prior to “onAck” callbacks being fired
  • beforeOnReply - gets called prior to “onReply” callbacks being fired
  • beforeOnData - gets called prior to any “on” callbacks being fired
  • beforeReply - gets called before a reply is sent

Pavel Petroshenko and others added 9 commits April 19, 2017 11:53
- Added four middleware functions:
  - beforeOnAck - gets called prior to “onAck” callbacks being fired
  - beforeOnReply - gets called prior to “onReply” callbacks being fired
  - beforeOnData - gets called prior to any “on” callbacks being fired
  - beforeReply - gets called before a reply is sent
@mm-gmbd
Copy link
Contributor Author

mm-gmbd commented May 4, 2017

For some reason, I can open a PR on the master branch, but not the develop branch (which I originally branched from). GH not working out well for me today.

Let me know what you think (although I think this is very similar to #15)

@betzrhodes
Copy link

Max can you provide the use case for adding middleware. This feels like it is adding a lot of complexity. Thanks.

@mm-gmbd
Copy link
Contributor Author

mm-gmbd commented Mar 9, 2018

Hey @betzrhodes, the request originally was borne out a need to perform some profiling Agent<->Device communication, and rather than tracking down every single send and on, it seemed appropriate to have middleware(s) for performing these types of global tasks.

At this very moment, the need has been somewhat reduced, but I could still see this being useful into the future (again, moreso around general profiling to provide early identification of potential system degradation, etc).

Can you explain the foreseen complexity? As far as actual implementation goes, it doesn't really add much in the way of extra code (just registers a few callbacks and calls them appropriately), and, from what I recall, it doesn't alter the overall flow (i.e. doesn't provide the ability to "drop" messages, etc), it just gives a way to access all messages at different points in the flow.

@imp-jenkins
Copy link

Can one of the admins verify this patch?

@betzrhodes betzrhodes changed the base branch from master to mm April 9, 2019 20:33
@betzrhodes betzrhodes merged commit 4c9c169 into electricimp:mm Apr 9, 2019
@betzrhodes
Copy link

Merged to mm branch to keep code. Currently no plans to merge this feature into a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants