# WSS Data Feed into Losant Workflow/Data

**URL:** <https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219>\
**Category:** Help\
**Tags:** integration\
**Created:** [August 15, 2023, 3:29pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219 "2023-08-15T15:29:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![CyberJMC66](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/cyberjmc66/32/4543_2.png) [@CyberJMC66](https://forums.losant.com/u/CyberJMC66)\
**Post date:** [August 15, 2023, 3:29pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/1 "2023-08-15T15:29:07Z")

</div>

Would like to incorporate WSS fed data into Losant workflow. It is for a voltage meter which is continually sending the following payload;

{  
“payload”: {  
“voltage”: [  
121.82426452636719,  
122.04183197021484  
],  
“frame”: 9327510,  
“devices”: [  
…

I have tried to use MQTT integration as recommended elsewhere in forums but no joy. What is the recommended means of incorporating this data into Losant?

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 15, 2023, 3:39pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/2 "2023-08-15T15:39:15Z")

</div>

I don’t have a great answer here; we have a websocket integration feature in our backlog, where the platform would act as a client and initiate a request, and you could then fire workflows on received messages and publish back over the connection. I will add your +1 to that request.

I’m afraid you’d have to bring in a third-party service to act as the WSS client and then forward payloads over to Losant via HTTP requests to a webhook or some other means. If you are doing this on the edge, you have additional options.

---

<div class="post-metadata">

**Author:** ![CyberJMC66](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/cyberjmc66/32/4543_2.png) [@CyberJMC66](https://forums.losant.com/u/CyberJMC66)\
**Post date:** [August 15, 2023, 4:08pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/3 "2023-08-15T16:08:53Z")

</div>

I can do this on the edge - please advise 🙂

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [August 15, 2023, 4:24pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/4 "2023-08-15T16:24:46Z")

</div>

There are a few ways to accomplish this, but depends on which direction the websocket connection is going. Is your source of websocket data a server and you require a websocket client to connect to that server? Or is the source of data a websocket client that requires a server to connect to?

---

<div class="post-metadata">

**Author:** ![CyberJMC66](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/cyberjmc66/32/4543_2.png) [@CyberJMC66](https://forums.losant.com/u/CyberJMC66)\
**Post date:** [August 15, 2023, 4:38pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/5 "2023-08-15T16:38:36Z")

</div>

> [@Brandon\_Cannaday](#):
>
> There are a few ways to accomplish this, but depends on which direction the websocket connection is going.

Websocket client - e.g. I am able to see the data using Postman WSS (beta)

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [August 15, 2023, 5:43pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/6 "2023-08-15T17:43:05Z")

</div>

Understood. I’ve seen two modes for websocket APIs like this. For yours, do you make a connection and data just begins flowing? Or is it transactional, where you make a connection and the client must send some request to the server and the server will reply with data?

---

<div class="post-metadata">

**Author:** ![CyberJMC66](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/cyberjmc66/32/4543_2.png) [@CyberJMC66](https://forums.losant.com/u/CyberJMC66)\
**Post date:** [August 16, 2023, 3:40pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/7 "2023-08-16T15:40:25Z")

</div>

Data begins flowing no request needed.

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [August 16, 2023, 7:58pm UTC](https://forums.losant.com/t/wss-data-feed-into-losant-workflow-data/5219/8 "2023-08-16T19:58:12Z")

</div>

I recommend running [websocat](https://github.com/vi/websocat) to forward websocket packets to the GEA’s UDP server.

For example, if your websocket server is running on `locahost:7777` and the GEA is listening on UDP port `3456`, the following command will connect to your websocket server and forward every packet to the GEA:

```auto
websocat --text ws://localhost:7777 udp:127.0.0.1:3456

```

Websocat is supported on all major CPU architectures and Linux distros. Here’s a guide on [installing websocat on a Raspberry Pi](https://lindevs.com/install-websocat-on-raspberry-pi). I used a Raspberry Pi 3 to test this implementation.

When running the GEA, you’ll need to expose the UDP port by adding the following to your Docker run command:

```auto
-p 3456:3456/udp

```

You’ll then need to add a [UDP Trigger](https://docs.losant.com/workflows/triggers/udp/) to your edge workflow with the same port as you exposed above.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/7/7e13acf5ced04fd17ea23104bd0f4919da4413fc.png)

Now whenever websocat receives a websocket packet, it will forward it to UDP and trigger your workflow.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/9/973e2800dedb236e56508004ca2e87052cdcb1c2.png)

Depending on your Linux distro, you’ll likely want to launch the websocat command as a service/daemon (systemd, upstart, etc). This way it launches on boot and will restart on any errors.
