Skip to content

Changing URL possible? #27

@chris-nolan

Description

@chris-nolan

Hi,

My app features the ability for users to dynamically change the backend service they are using, and this selection drives the URL I need to connect to via socket.io. I've set the URL to useSocket to the current URL from a context provider, but when the URL changes I don't get a new socket connection to the updated URL. Is this something that is possible?

e.g.

const [environmentConfig] = useEnvironment();
const { socket, error, connected } = useSocket(environmentConfig.urls.backend);

When environmentConfig changes, socket remains connected to the previous URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions