mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-04 09:17:32 -05:00
24 lines
597 B
Go
24 lines
597 B
Go
package internal
|
|
|
|
import (
|
|
"github.com/v2ray/v2ray-core/app"
|
|
)
|
|
|
|
type PubsubWithContext interface {
|
|
Publish(context app.Context, topic string, message app.PubsubMessage)
|
|
Subscribe(context app.Context, topic string, handler app.TopicHandler)
|
|
}
|
|
|
|
type contextedPubsub struct {
|
|
context app.Context
|
|
pubsub PubsubWithContext
|
|
}
|
|
|
|
func (this *contextedPubsub) Publish(topic string, message app.PubsubMessage) {
|
|
this.pubsub.Publish(this.context, topic, message)
|
|
}
|
|
|
|
func (this *contextedPubsub) Subscribe(topic string, handler app.TopicHandler) {
|
|
this.pubsub.Subscribe(this.context, topic, handler)
|
|
}
|