// import { io } from "https://cdn.socket.io/4.4.1/socket.io.esm.min.js";

export class Connection {
  constructor(config) {
    socket: null;
    client: null;
    userSig: null;
    this.init(config);
  }

  startSocket(config) {
    //192.168.0.52:9099/?userId=123
    console.log("init-startSocket");
    const {  sceneCode, userId } = config;
    const socketUrl ='wss://demo-kms.4dage.com'
    // const socketUrl ='ws://192.168.0.152:9099'
    this.socket = io(socketUrl, {
      reconnectionDelayMax: 10000,
      transports: ["websocket"],
      query: {
        userId: userId,
        sceneCode: sceneCode,
      },
    });
    this.socket.on("connect", (data) => {
      console.log("111", data);
    });
    this.socket.on("connect_error", (error) => {
      console.log("error", error);
    });

    // setTimeout(() => {
    //   console.log("this.socket", this.socket);
    // }, 3000);
  }

   init(config) {
    console.log("init-trtc",config);
    this.startSocket(config);
  }
}
