Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appevent module implementation. #371

Merged
merged 2 commits into from
May 26, 2020
Merged

Appevent module implementation. #371

merged 2 commits into from
May 26, 2020

Conversation

evanlinjin
Copy link
Contributor

@evanlinjin evanlinjin commented May 21, 2020

Fixes #370

The appevent module allows for events to be broadcasted from visor (via appserver) to apps.
Events have an event type what determines the contents of the event data.
Apps subscribe to chosen event types, which are broadcasted via event channels (one event channel per event type).

  • Introduced a new optional line of communication between app/visor for event broadcast, in which app hosts the listener and the visor (via appserver) does the dial. The app advertises this optional listening address (if it exists) to the visor via the main app <-> visor connection.
  • Apps now use the appcommon.Hello JSON object as their initial dial message to appserver (this contains the proc_key, and event broadcast connection related fields).
  • app.NewClient() now has an optional appevent.Subscriber as input. If defined, the broadcast event connection will be created and the appevent.Subscriber object will be used for receiving events.
  • Updated dmsg version to make use of callbacks (for dialing and closing sessions).

Other changes:

  • Updated golangci-lint version for travis.
  • Updated helloworld app to listen/write in a loop and to log all events comming from appserver.

Testing instructions

  1. Run visor with helloworld app.
  2. Restart the dmsg server which the visor is connected to.
  3. Inspect visor/app logs.

@evanlinjin evanlinjin changed the title Appserver egress gateway implementation. Appserver events gateway implementation. May 23, 2020
@evanlinjin evanlinjin changed the title Appserver events gateway implementation. Appevent module implementation. May 24, 2020
The appevent module allows for events to be broadcasted from visor (via appserver) to apps.
Events have an event type what determines the contents of the event data.
Apps subscribe to chosen event types, which are broadcasted via event channels (one event channel per event type).

* Introduced a new optional line of communication between app/visor for event broadcast, in which app hosts the listener and the visor (via appserver) does the dial. The app advertises this optional listening address (if it exists) to the visor via the main app <-> visor connection.
* Apps now use the appcommon.Hello JSON object as their initial dial message to appserver (this contains the proc_key, and event broadcast connection related fields).
* app.NewClient() now has an optional appevent.Subscriber as input. If defined, the broadcast event connection will be created and the appevent.Subscriber object will be used for receiving events.
* Updated dmsg version to make use of callbacks (for dialing and closing sessions).

Other changes:
* Updated golangci-lint version for travis.
* Updated helloworld app to listen/write in a loop and to log all events comming from appserver.
@evanlinjin evanlinjin marked this pull request as ready for review May 24, 2020 22:07
Copy link
Contributor

@Darkren Darkren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly stylish comments, may be considered a matter of taste. Overall good job!

cmd/apps/helloworld/helloworld.go Outdated Show resolved Hide resolved
pkg/app/appcommon/hello.go Outdated Show resolved Hide resolved
pkg/app/appevent/broadcaster.go Outdated Show resolved Hide resolved
pkg/app/appevent/broadcaster_test.go Outdated Show resolved Hide resolved
pkg/app/appevent/subscriber.go Outdated Show resolved Hide resolved
pkg/snet/network.go Show resolved Hide resolved
* Remove various empty lines and fix typos.
* Remove unnecessary chan close in appevent.Broadcaster.
* Make multiple calls to .OnTCPDial and .OnTCPClose safe for appevent.Subscriber
@Darkren Darkren merged commit edac199 into develop May 26, 2020
@jdknives jdknives deleted the feature/app-rpc-interface branch May 26, 2020 17:34
jdknives pushed a commit that referenced this pull request Oct 19, 2020
Appevent module implementation. 

Former-commit-id: edac199
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.

2 participants