# Using websocket protocol to gather data from device

**URL:** <https://forum.inductiveautomation.com/t/using-websocket-protocol-to-gather-data-from-device/82398>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [November 27, 2023, 7:17pm UTC](https://forum.inductiveautomation.com/t/using-websocket-protocol-to-gather-data-from-device/82398 "2023-11-27T19:17:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 28, 2023, 5:22pm UTC](https://forum.inductiveautomation.com/t/using-websocket-protocol-to-gather-data-from-device/82398/2 "2023-11-28T17:22:28Z")

</div>

There's some potentially useful snippets for creating a websocket client in this thread - make sure you scroll all the way through 🙂

> [@WebSocket Client](https://forum.inductiveautomation.com/t/websocket-client/44447/21):
>
> Merged at this point from here: So after clarifying some additional code that was needed and running from the correct gateway context, it works! This means we have a way to get data into Ignition from massive Kafka topics by using the lenses SQL api mentioned here: [https://api.lenses.io/branches/4.3/index.html#data-access-query-data-via-sql-get](https://api.lenses.io/branches/4.3/index.html#data-access-query-data-via-sql-get) There were a few more things required, namely encoding the text you send and conversion of the return (here I just put it to string so as…

---

_[View the full topic](https://forum.inductiveautomation.com/t/using-websocket-protocol-to-gather-data-from-device/82398)._
