Skip to content

Possibility to reconnect with a different URL #470

Closed
@rmnblm

Description

@rmnblm

I am building an app where it is possible to change the Socket URL at runtime. A few ViewControllers have registered callbacks on different socket events. The problem here is obvious: When I'm creating a new SocketIOClient instance, the SocketEventHandler 'handlers' in SocketIOClient.swift is empty and all my callbacks are gone. There should be the possibility to reconnect to a different URL while preserving all handlers. Am I the only one who's in need for this or is there already a good workaround? 🙈

There could be two different solutions I could think of

  • Offer a method called connect(newSocketURL: URL) which sets the socketURL instance variable and call addEngine().connect() to start a new engine with the new URL
  • Offer a method to transfer the current [SocketEventHandler] array called handlers from one socket to another to preserve these handlers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions