diff --git a/packages/socket-apollo-link/src/createAbsintheSocketLink.js b/packages/socket-apollo-link/src/createAbsintheSocketLink.js index d07a0b0a..34ef61f4 100644 --- a/packages/socket-apollo-link/src/createAbsintheSocketLink.js +++ b/packages/socket-apollo-link/src/createAbsintheSocketLink.js @@ -59,7 +59,7 @@ const notifierToObservable = (absintheSocket, onError, onStart) => notifier => { }; return new Observable(subscriber => { - observer.onAbort = subscriber.error; + observer.onAbort = subscriber.error.bind(subscriber); observer.onResult = onResult(notifier, subscriber); observe(absintheSocket, notifier, observer); diff --git a/packages/socket/src/toObservable.js b/packages/socket/src/toObservable.js index 592ece40..06ac082a 100644 --- a/packages/socket/src/toObservable.js +++ b/packages/socket/src/toObservable.js @@ -37,12 +37,12 @@ const toObservable = ( notifier: Notifier, {onError, onStart, unsubscribe}: $Shape> = {} ) => - new Observable(observer => { + new Observable(subscriber => { observe(absintheSocket, notifier, { onError, onStart, - onAbort: observer.error, - onResult: onResult(notifier, observer) + onAbort: subscriber.error.bind(subscriber), + onResult: onResult(notifier, subscriber) }); return unsubscribe;