You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should we just use one channel on GetChannelID()? so we only filter on one specific channel field?
Should we refactor our filtering mechanism?
Refactoring
// Matcher is an interface Handles can implement to provide event filtering
type Matcher interface {
Matches(evt ari.Event) bool
}
// ChannelEvent allows arbitrary events to give a Matcher a series of Channel IDs to operate on.
type ChannelEvent interface {
GetChannelIDs() []string // multiple ID support
}
// Example code:
var channelHandle ChannelHandle
evt <- sub.Events()
if !channelHandle.Matches(evt) {
//ignore event
} else {
// process event
}
Writing this up.... I think I'll go with the refactoring anyway. That will move the event filtering logic from the individual Subscribe implementations in client/native and client/nc into the main ari package and each client only needs to call handle.Matches(evt) before dispatching to the subscription.