Closed
Description
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 calladdEngine().connect()
to start a new engine with the new URL - Offer a method to transfer the current
[SocketEventHandler]
array calledhandlers
from one socket to another to preserve these handlers