absinthe-graphql / absinthe-socket

Core JavaScript support for Absinthe WS-based operations
MIT License
149 stars 75 forks source link

Unsubscribe not working #48

Open michaeljguarino opened 4 years ago

michaeljguarino commented 4 years ago

I've been debugging some issues in one of my apps, and drilled down to the most likely cause being apollo subscription cancels not flushing to the absinthe socket. To reproduce, I simply called a subscribeToMore for one of my queries and immediately called the cancel callback function after, and observed no unsubscribe event pushed to the socket.

I'm using a newer version of apollo, so this might be a regression (and i seem to remember seeing this working with older versions of apollo's react client). Here are the versions:

"@absinthe/socket": "^0.2.1",
"@absinthe/socket-apollo-link": "^0.2.1",
"@apollo/react-hooks": "^3.1.5",
"apollo-boost": "^0.4.7",
bernardo-martinez commented 4 years ago

hey! I think i have the same issue. I'm using "@absinthe/socket": { "version": "0.2.1" }

I'm following the approach described on the documentation: creating an Observable, calling subscribe on it and afterwards calling unsubscribe on the subscription it returns.

I'm doing this on some tests on Jest and unsubscribing on the afterAllcallback, but in the end Jest keeps complaining with: Jest did not exit one second after the test run has completed and it keeps running, which leds me think the connection wasn't closed correctly

ademola-raimi commented 3 years ago

Hello, Does anyone have a solution to this? Apparently, the issue was also discussed here, but the solution did not work for me.