Get data stream from Websocket DAT

Hi everyone!
Can somebody help me to make Websocket DAT working? I want to read data from wss stream (you can try it as well — wss://ramiel.pulsoid.net/listen/7f20184a-5fcf-11e6-8b77-86f30ca893d3 this URL should be active for some days) but can’t figure out how to do it with DATs.
Meanwhile with Python websocket library it works well:

{ "timestamp" : 1543682597264, "data" : { "heartRate" : 80 } }

I just put that url into the Network Address of a default Web Socket, and immediately start getting information in the callbacks.

You’ll have to do something with the data in the callbacks below.

In my case, I just print it out to the textport:

def onReceiveText(dat, rowIndex, message): print('receive', message) return

In your case, you’ll want to parse the json with the python json library.

Hope that helps,
Cheers,
Rob.

Here’s what the output looks like:

Hmm… That’s weird. Mine doesn’t work with the same setup. And python version from command line works at the same time with a same connection.
Do you have any suggestions what did I miss?

Exsstas I recommend posting your .toe file next time instead of a screenshot where some of your code isn’t visible :wink:
I just tried your url and got it working as well- here’s the working toe file:
websocket.toe (4.12 KB)

1 Like

I didn’t post .toe just because it consist only of 1 node.
Your version doesn’t work too.
I checked Antivirus/Firewall — it didn’t block TD at all (I’ve tried to turn it off as well).
Touch have an access to Web and if I add Web DAT and fetch Web version of this tool ([url]PULSOID) I got HTML code in the node.

I run out of ideas how to narrow down it further.

PS: I’m using VPN connection — could it affect TD behavior?

Hey,

while it worked for me using port 80, can you try switching the port to 443 as it’s a secure socket?

Cheers
Markus

It’s working now! Thank you, Markus!