Need help for @huddle01/web-core

Hi, finally here. So difficult to find dev support.
My team are trying to implement Huddle01 audio and video using the @huddle01/web-core SDK but repeatedly get error:

Some snippet from the implementation:

async joinRoom(roomId: string, token: string): Promise<Room> {
        await this.huddleClient.socket.connect({ token: token });
        this.room = Room.create();
        this.room.roomId = roomId
        return this.room
    }

    async joinCall() {
        console.log(`huddle: joining call`, { user: this.user })
        try {
            if (!this.activeSession) {
                throw new Error("no session")
            }
            this.room = await this.joinRoom(this.activeSession.roomId, this.activeSession.accessToken)
            this.invokeRoomHandlers(this.room)
            return true
        } catch (e) {
            throw new Error(e as string)
        }
    }

    private invokeRoomHandlers(room: Room) {
        this.huddleClient.socket.on("connected", () => {
            console.log('huddle: socket connect', this.room)
            if (this.room) {
                console.log('huddle: joining room')
                this.room.connect()
            }
        })
        room.on("room-joined", async () => {
            console.log('HC: Joined Room')
            await this.huddleClient.localPeer.enableAudio();
        })
        room.on("new-peer-joined", ({ peer }) => {
            console.log('new participant joined')
            this.peer = { peerId: peer.peerId, stream: undefined, status: "not-ready" }
            this.eventEmitter.emit("participant-joined", this.peer)
            peer.on("stream-playable", (stream) => {
                if (this.peer) {
                    this.peer.stream = stream
                    this.eventEmitter.emit("participant-ready", this.peer)
                }
            })
        })
    }

Who can help me solve this ? :slightly_smiling_face:
Tell me if I need to provide with something for solving this

Hi @alex
have you checked out the example apps?
maybe you can find something there

you can bootstrap an app using the CLI, CLI Tool – Huddle01's Documentation

Yes tried CLI and demo apps
It work well but we are not trying to build app but it is a service which is why we choose server-sdk and web-core
We have service which listens to some events, on events it will check if we need a room if room is required then our server will create room and access token, send that access token to user and join using web-core sdk. Not want to be limited to react and framework :slightly_smiling_face:

the issue is with your joinRoom function you have connected to the socket and then did Room.create() which is incorrect way of doing things.

You should directly use this.huddleClient.joinRoom() and it will automatically handle everything for you

If you want to be more specific you can do this.huddleClient.socket.connect() and then this.huddleClient.room.connect()```.

async joinRoom(roomId: string, token: string): Promise<Room> {
        await this.huddleClient.socket.connect({ token: token }).catch(console.error);
        this.room = this.huddleClient.room.connect();
        return this.room
    }

Hi omg
We already tried joining room directing with huddleClient.joinRoom() but there are many other errors
When we do the other solution you say:

async joinRoom(roomId: string, token: string): Promise<Room> {
        await this.huddleClient.socket.connect({ token: token }).catch(console.error);
        this.room = this.huddleClient.room.connect();
        return this.room
    }

This problem happens where await this.huddleClient.socket.connect({ token: token }).catch(console.error); does not resolve to socket state connected and we get error for this.room = this.huddleClient.room.connect(); saying socket still in connecting state

Can you share what the socket promise resolves?

const socket = await this.huddleClient.socket.connect()
console.info({socket});

Also, we expose the function this.huddleClient.joinRoom() which does the exact thing in one function.

When do huddleClient.joinRoom() :slightly_smiling_face:

any update on this im waiting…

Can you send the roomId you are using to connect ?
Let me check on my end.