cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Widget 3rd-party Libraries

SOLVED
Bedrock

Custom Widget 3rd-party Libraries

Hi, 

So far I have manage to create a chat widget. 

I was thinking of using socket.io to do so but somehow I am not able to use the library. 
Yes, I have already look through several resources before opening this topic but none of this has helped.

 

I am getting an error known as "mismatched anonymus define() module".

 

Any help on this would be great, thanks!

 

https://community.ptc.com/t5/IoT-Tech-Tips/Widget-Extensions-Using-AAGRID-a-JS-library/td-p/535060

https://community.ptc.com/t5/ThingWorx-Developers/How-can-I-reference-my-js-libraries-in-custom-exte...

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Custom Widget 3rd-party Libraries

This is because socket.io doesn't work with the require and define methods from the Thingworx 8.5 runtime.

 

One of the possible workarounds for this is documented in the Thingworx 8.5 release notes (at the end of the document).

 

An alternative might be to include socket.io using npm and webpack via this extension project.

 

However you can also work with web sockets on the client side without any other library through the WebSocket API.

View solution in original post

4 REPLIES 4
Highlighted

Re: Custom Widget 3rd-party Libraries

What is the exact version of your Platform ? Is it 8.5.0 ?

Regards.

Highlighted

Re: Custom Widget 3rd-party Libraries

Hi, yes it is. 

 

I am using the trial foundation where I download and it could be used for 90 days. 

 

My company already has the software but in order to work at home, I have to use the trial version.

 

But anyway, I tried to import the library using cdn of FileResources / renderHTML/ AfterRender(appending to body). All of this method did not work. 

Thanks!

Highlighted

Re: Custom Widget 3rd-party Libraries

This is because socket.io doesn't work with the require and define methods from the Thingworx 8.5 runtime.

 

One of the possible workarounds for this is documented in the Thingworx 8.5 release notes (at the end of the document).

 

An alternative might be to include socket.io using npm and webpack via this extension project.

 

However you can also work with web sockets on the client side without any other library through the WebSocket API.

View solution in original post

Highlighted

Re: Custom Widget 3rd-party Libraries

Hi, thanks so much for the reply!

 

I am using the one from Widget Extension(npm) and it works great, I was able to require the package and run it! The only problem I have with this is that I am not sure how to put in Thingworx Template / Service / Property. Do I code it the same way as how I did with Eclipse?

Will try the one from Thingworx 8.5 release notes  and let anyone who is looking for a solution using Eclipse SDK know if it is working.  

 

Thanks so much for the help!

Enze. 

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________