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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Live chat websocket

enze
9-Granite

Live chat websocket

Hi everyone, currently I have created a custom chat widget. In order to do a live chat, I would require to open a socket connection in the service itself and have my custom widget involve this service. So my question is, is it possible to do web socket connection with javascript in the service itself? How should I approach this? 

 

Thanks!

4 REPLIES 4
tmisner
16-Pearl
(To:enze)

Hello enze,

 

I wanted to follow up on this topic to determine if you were able to move forward with your Live Chart idea. If so how did you accomplish this? This is an interesting concept which I'm sure other customers would find useful.

enze
9-Granite
(To:tmisner)

Spoiler
 

Hey there! Yes I was able to move on with the idea. So Thingworx chat would be the client side itself. I had to create a custom widget with the help of https://github.com/ptc-iot-sharing/ThingworxDemoWebpackWidget. By using this, I was able to create a custom widget and use socket.io JS library for it. 

So in short, thingworx widget is used as a client. I then create my own chat server using MEAN stack (not completed, only did the backend of it) and tested on my localhost with the thingworx server. Was able to communicate! 

tmisner
16-Pearl
(To:enze)

Hello enze,

 

Thank you very much for taking the time to explain how this was ultimately accomplished.

enze
9-Granite
(To:tmisner)

Let me know if there are other ways to do this! But for now I feel that having a custom widget would be the best solution. Since at the end of the day we need to make use of sockets instead of http protocol. And this is why client side will be the way to do it. 
Doing it with service will not work because service itself make use of API = http protocol. 

 

Anyway if anyone requires help on this OR have any new insights just feel free to PM me. I would be glad to hear your suggestion / help you in it! 

Top Tags