Git Product home page Git Product logo

Comments (4)

RPloutarchou avatar RPloutarchou commented on May 18, 2024 2

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.

NavidK0 avatar NavidK0 commented on May 18, 2024 1

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.

RPloutarchou avatar RPloutarchou commented on May 18, 2024 1

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.

NavidK0 avatar NavidK0 commented on May 18, 2024 1

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.