@@ -47,6 +47,8 @@ func (p *peerChannelsNotifySvc) Subscribe(ctx context.Context, channel *payd.Pee
47
47
channel .CreatedAt = time .Now ()
48
48
}
49
49
50
+ log .Debug ().Msgf ("subscribing to channel %s with token %s at %s%s" , channel .ID , channel .Token , channel .Host , channel .Path )
51
+
50
52
u := url.URL {
51
53
Scheme : "ws" ,
52
54
Host : channel .Host ,
@@ -76,6 +78,8 @@ func (p *peerChannelsNotifySvc) Subscribe(ctx context.Context, channel *payd.Pee
76
78
}()
77
79
78
80
sub := payd.PeerChannelSubscription {
81
+ Host : channel .Host ,
82
+ Path : channel .Path ,
79
83
ChannelID : channel .ID ,
80
84
ChannelType : channel .Type ,
81
85
Token : channel .Token ,
@@ -107,6 +111,7 @@ func (p *peerChannelsNotifySvc) listen(ctx context.Context, sub *payd.PeerChanne
107
111
log .Error ().Err (errors .WithStack (err ))
108
112
}
109
113
114
+ log .Debug ().Msgf ("message received on channel %s" , sub .ChannelID )
110
115
in <- true
111
116
}()
112
117
@@ -124,13 +129,17 @@ func (p *peerChannelsNotifySvc) listen(ctx context.Context, sub *payd.PeerChanne
124
129
func (p * peerChannelsNotifySvc ) handleNotification (ctx context.Context , sub * payd.PeerChannelSubscription , cancel context.CancelFunc ) error {
125
130
msgs , err := p .pcSvc .PeerChannelsMessage (ctx , & payd.PeerChannelMessageArgs {
126
131
ChannelID : sub .ChannelID ,
132
+ Host : sub .Host ,
133
+ Path : sub .Path ,
127
134
Token : sub .Token ,
128
135
})
129
136
if err != nil {
130
137
log .Error ().Err (errors .WithStack (err ))
131
138
return err
132
139
}
133
140
141
+ log .Debug ().Msgf ("channel %s fetched messages: %#v" , sub .ChannelID , msgs )
142
+
134
143
hdlr := p .handlers [sub .ChannelType ]
135
144
finished , err := hdlr .HandlePeerChannelsMessage (ctx , msgs )
136
145
if err != nil {
0 commit comments