Skip to content

Instantly share code, notes, and snippets.

@dragonsinth
Last active December 17, 2021 12:25
Show Gist options
  • Save dragonsinth/ea1afb8e8f6bcef7076d5e2e84f9fe1e to your computer and use it in GitHub Desktop.
Save dragonsinth/ea1afb8e8f6bcef7076d5e2e84f9fe1e to your computer and use it in GitHub Desktop.
promise := eventStream.Subscribe()
for {
select {
case <-ctx.Done():
return ctx.Err()
case <-promise.Ready():
v, nextPromise := promise.Next()
if v == nil {
return nil
}
promise = nextPromise
msg := v.(bwamp.Event)
// [Send msg to client]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment