Hey everyone, I have questions about

Hey everyone, I have questions about initializing the Thoughtspot SDK. As far as I understand before embedding Liveboards I have to initialize SDK with
init({
thoughtSpotHost: "https://<hostname>:<port>",
authType: <AuthType>,
... // other authType dependent properties.
});
init({
thoughtSpotHost: "https://<hostname>:<port>",
authType: <AuthType>,
... // other authType dependent properties.
});
And here is my question: * Does init() creates a global state or I can have multiple init() instances for different ThoughtSpot Hosts? For example I have 2 ThoughtSpot Hosts with their own sets of Liveboards, is it possible to somehow configure SDK so I can embed Liveboard from both Hosts at the same page at the same time?
11 Replies
shikharTS
shikharTS5w ago
I think you should be able to use 2 init for different TS hosts. Each will initialize the corresponding TS host. @jbc to correct me if I am wrong..
Stellnox
StellnoxOP5w ago
Hm, interesting. So theoretically I can do something like this
init({
thoughtSpotHost: "Host 1",
authType: <AuthType>,
... // other authType dependent properties.
});
init({
thoughtSpotHost: "Host 2",
authType: <AuthType>,
... // other authType dependent properties.
});
init({
thoughtSpotHost: "Host 1",
authType: <AuthType>,
... // other authType dependent properties.
});
init({
thoughtSpotHost: "Host 2",
authType: <AuthType>,
... // other authType dependent properties.
});
Considering that credentials for both hosts is correct. And that should allow me to embed Liveboards from "Host 1" and "Host 2"?
shikharTS
shikharTS5w ago
I think so yes.
Stellnox
StellnoxOP5w ago
Ok, thanks, I'll give it a shot
shikharTS
shikharTS5w ago
Hey @Stellnox I confirmed with @jbc (senior FE engineer) internally. Looks like this is not possible. We have a limitation on our side
We store a single instance of init config. That’s our limitation. They cannot instantiate with multiple hosts., it will override with the last invoked call
We store a single instance of init config. That’s our limitation. They cannot instantiate with multiple hosts., it will override with the last invoked call
What is your use case though? What 2 instances of TS do you have?
Stellnox
StellnoxOP5w ago
That's a bummer, I dont have any specific instance to share. My usecase in that I would like to embed several Liveboards from different TS hosts.
shikharTS
shikharTS5w ago
Usually we have just one TS host per customer.. Can you give an example of the different TS hosts?
Stellnox
StellnoxOP5w ago
Well I dont have any specific example unfortunately, its just that edge case when I need to embed liveboard from different hosts.
shikharTS
shikharTS5w ago
I see. Will let @jbc comment here once he gets time to give workarounds if possible.
Stellnox
StellnoxOP5w ago
Thank you a lot!
jbc
jbc5w ago
Hey @Stellnox , at the moment we don't have a support for multiple hosts as that wasn't a known requirement so far. You can raise this as a feature request and we could solution this further. cc @Himanshu Arora @Nicolas The workarounds that can be suggested might be too complicated to implement on your end. You would need a different scope for each usage, so you could save the SDK bundle as separate file within your codebase. eg: tsembed-1.js and tsembed-2.js Or add a NodeJs helper which loads the our SDK with a different name everytime you call it.

Did you find this page helpful?