Skip to main content
1-Visitor
February 9, 2020
Solved

Custom Widget 3rd-party Libraries

  • February 9, 2020
  • 1 reply
  • 2486 views

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-extension-widget/td-p/522357

Best answer by bmihaiciuc

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.

1 reply

16-Pearl
February 10, 2020

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

Regards.

enze1-VisitorAuthor
1-Visitor
February 11, 2020

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!

5-Regular Member
February 12, 2020

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.