How to make two websocket connection on a single page using Timeme.js

Viewed 31

I am using Timeme.js library's web socket functionality to connect my page with the socket. My requirement is to connect two sockets from different urls, in same page. Here is what I tried:-

 TimeMe.initialize({
        idleTimeoutInSeconds: 1000,
        websocketOptions: {
            websocketHost: "/firstSocketUrl"
        }
    }); 

TimeMe.websocket.on("firstSocketResponse",(data)=>{
            console.log("first socket response ->",data);
        });

 TimeMe.initialize({
            idleTimeoutInSeconds: 1000,
            websocketOptions: {
                websocketHost: "/secondSocketUrl"
            }
        }); 

TimeMe.websocket.on("secondSocketResponse",(data)=>{
            console.log("first socket response ->",data);
        })

But I am not receiving the backend response, is it possible to do something like this using Timeme.js kindle let me know? Thank you

0 Answers
Related