Comments (4)
It works great! Everything else I have tried worked fine in the editor but not on an actual phone. This solution is perfect! Thank you so much for your help!!
from simplegraphql-for-unity.
I have multiple subscription open within a mobile game I am developing. I was wandering If there is any way to unsubscribe from all active subscriptions and unregister all their listeners in order to safely reload my game.
You can use GraphQLClient.Unsubscribe(id) to unsubscribe a listener. Unfortunately, there is no way to unsubscribe from all listeners at once because GraphQLClient does not keep track of subscription ids.
That being said, if you want to dispose of the WebSocket and have it make a new one, you can use HttpUtils.Dispose() which will dispose of the current underlying WebSocket (and force it to make a new one the next time a subscription is created). I am unsure if this will unsubscribe all the listeners associated with that WebSocket, however, but it's worth a shot to try and find out.
from simplegraphql-for-unity.
I have multiple subscription open within a mobile game I am developing. I was wandering If there is any way to unsubscribe from all active subscriptions and unregister all their listeners in order to safely reload my game.
You can use GraphQLClient.Unsubscribe(id) to unsubscribe a listener. Unfortunately, there is no way to unsubscribe from all listeners at once because GraphQLClient does not keep track of subscription ids.
That being said, if you want to dispose of the WebSocket and have it make a new one, you can use HttpUtils.Dispose() which will dispose of the current underlying WebSocket (and force it to make a new one the next time a subscription is created). I am unsure if this will unsubscribe all the listeners associated with that WebSocket, however, but it's worth a shot to try and find out.
Thanks for the reply, I will try using the Dispose() method as suggested. Thanks again for your help.
from simplegraphql-for-unity.
I have multiple subscription open within a mobile game I am developing. I was wandering If there is any way to unsubscribe from all active subscriptions and unregister all their listeners in order to safely reload my game.
You can use GraphQLClient.Unsubscribe(id) to unsubscribe a listener. Unfortunately, there is no way to unsubscribe from all listeners at once because GraphQLClient does not keep track of subscription ids.
That being said, if you want to dispose of the WebSocket and have it make a new one, you can use HttpUtils.Dispose() which will dispose of the current underlying WebSocket (and force it to make a new one the next time a subscription is created). I am unsure if this will unsubscribe all the listeners associated with that WebSocket, however, but it's worth a shot to try and find out.Thanks for the reply, I will try using the Dispose() method as suggested. Thanks again for your help.
Do let me know how it goes! There are some easy solutions here that can be added to make this easier for developers.
from simplegraphql-for-unity.
Related Issues (20)
- GraphQLConfig Files list doesn't accept .graphql files HOT 4
- Subscribe API needs to be updated to match Send API
- Comments need to be updated to reflect new API changes
- Assembly with name 'Tests' already exists (Packages/com.lastabyss.simplegraphql/Tests/Runtime/LastAbyss.SimpleGraphQL.Runtime.Tests.asmdef) HOT 1
- Add Tests for subscriptions
- Improve documentation
- A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray HOT 1
- Use NativeWebSocket lib for WebSockets
- Slower Calls After Update HOT 6
- Wrong URL in the documentation HOT 2
- Subscriptions didn't work with my GraphQL Server until I added an empty Payload to the connection init. HOT 3
- error CS0539: 'LinkXmlInjector.OnBeforeRun(BuildReport, UnityLinkerBuildPipelineData)' in explicit interface declaration is not found among members of the interface that can be implemented HOT 6
- Headers not working in subscriptions with aws appsync HOT 6
- Subscriptions not found using FindQuery (if placed together wit other graphql statements) HOT 2
- No support for arrays in GraphQL Input types?
- Old projects not compiling after upgrading minor version HOT 2
- Problems when subscriptions complete HOT 8
- Question, handling different response Types HOT 1
- definition for 'Result' and no accessible extension method 'Result' accepting a first argument of type 'Response<<anonymous type: HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplegraphql-for-unity.