Skip to content

Connect to an other socket.io server #4246

Answered by darrachequesne
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! You should be able to update the Manager uri attribute:

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 private readonly attribute.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ghost
Comment options

@mikejpeters
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants