Connect to an other socket.io server #4246
-
Hello, I would like to know if there is a way to disconnect from a socket.io server and connect to an other with a new ip/domain without losing socket listeners ? |
Beta Was this translation helpful? Give feedback.
Answered by
darrachequesne
Jan 12, 2022
Replies: 1 comment 2 replies
-
Hi! You should be able to update the Manager import { io } from "socket.io-client";
const socket = io("https://my-domain-a.com");
socket.io.uri = "https://my-domain-b.com";
// force reconnection
socket.disconnect().connect(); The TypeScript compiler might complain though, as it's a |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! You should be able to update the Manager
uri
attribute:The TypeScript compiler might complain though, as it's a
private readonly
attribute.