Skip to content

Commit

Permalink
Removed OnError method on the channel, removed related references
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Dec 3, 2023
1 parent d2cc0cf commit 1ddf6cb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
11 changes: 0 additions & 11 deletions ably/realtime_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,6 @@ func (c *RealtimeChannel) SubscribeAll(ctx context.Context, handle func(*Message
return unsubscribe, nil
}

// OnError registers an event listener for error messages on this channel.
//
// See package-level documentation => [ably] Event Emitters for details about messages dispatch.
func (c *RealtimeChannel) OnError(handle func(*ErrorInfo)) (func(), error) {
// unsubscribe deregisters all listeners to error messages on this channel.
unsubscribe := c.errorEmitter.OnAll(func(err emitterData) {
handle((*ErrorInfo)(err.(*errorMessage)))
})
return unsubscribe, nil
}

type channelStateChanges chan ChannelStateChange

func (c channelStateChanges) Receive(change ChannelStateChange) {
Expand Down
4 changes: 0 additions & 4 deletions ably/realtime_presence.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ func (pres *RealtimePresence) addPresenceMember(memberMap map[string]*PresenceMe
isMemberNew, err := presenceMember.IsNewerThan(existingMember) // RTP2b
if err != nil {
pres.log().Error(err)
errorInfo := newError(0, err)
pres.channel.errorEmitter.Emit(subscriptionName("error"), (*errorMessage)(errorInfo))
}
if isMemberNew {
memberMap[memberKey] = presenceMember
Expand All @@ -265,8 +263,6 @@ func (pres *RealtimePresence) removePresenceMember(memberMap map[string]*Presenc
isMemberNew, err := presenceMember.IsNewerThan(existingMember) // RTP2b
if err != nil {
pres.log().Error(err)
errorInfo := newError(0, err)
pres.channel.errorEmitter.Emit(subscriptionName("error"), (*errorMessage)(errorInfo))
}
if isMemberNew {
delete(memberMap, memberKey)
Expand Down

0 comments on commit 1ddf6cb

Please sign in to comment.