Code Monkey home page Code Monkey logo

Comments (6)

davidstump avatar davidstump commented on June 28, 2024

Issue #39 is talking about a public leave function for disconnecting from a socket connection. Any reason not to also stop all timers and make that the recommended way to leave and disconnect?

from swiftphoenixclient.

NilsLattek avatar NilsLattek commented on June 28, 2024

The leave function is for leaving a channel and not fully closing a socket if I understand this correctly?
At the moment I am using this implementation to fully disconnect the socket from the server: https://github.com/NilsLattek/SwiftPhoenixClient/blob/disconnect/Pod/Classes/Phoenix.swift#L266-L276
(Use Case scenario: User performs a logout and I want to fully close the connection. Or goes into an offline mode.

from swiftphoenixclient.

davidstump avatar davidstump commented on June 28, 2024

Ah yeah - good call. The leave function could be used for an individual channel, but leave other channels open if desired.

The only potential issue I see is that if we are making a public way to disconnect from the socket, your function does not allow a user to pass a callback like they could with the close function by itself. I might be in favor of a solution where invalidateTimers is a function that gets called when a public close function is called on Socket.

Thoughts?

from swiftphoenixclient.

NilsLattek avatar NilsLattek commented on June 28, 2024

Yes that sounds good to me. So we would have a new function invalidateTimers which is private and then make socket close public and call invalidateTimers inside. Correct?

from swiftphoenixclient.

davidstump avatar davidstump commented on June 28, 2024

Just set close and leave to public and added the invalidateTimers function on the most recent commit to master. Will go out with the next release.

Cheers!

from swiftphoenixclient.

NilsLattek avatar NilsLattek commented on June 28, 2024

Awesome, thank you! Just tested the master branch. 👍

from swiftphoenixclient.

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.