ionorg / ion-sdk-go

ion sdk for golang
MIT License
55 stars 46 forks source link

Signal error handling #3

Closed kevindejong closed 3 years ago

kevindejong commented 3 years ago

Description

Provides a mechanism to handle signalling errors similar to the JavaScript SDK.

Adds an OnError callback to Signal and Client which propagates errors from the signal stream client to the user. Also changes Signal.onSignalHandle to be started on first use of the signalling client rather than in the constructor to avoid a race condition between the when OnError is registered and when the read loop can call it.

An alternative to the once starting the read loop would have been an explicit Start method which would needed to be called in the Client, however I favoured this as didn't change the Signal interface.

adwpc commented 3 years ago

Thanks! Can you add an example to show how to use it