How Do I Use WebSockets for Data Communication in LabVIEW?

Updated May 8, 2024



  • LabVIEW
  • JKI VI Package Manager

I want to use WebSockets for data communication in LabVIEW. How do I set that up, and where can I find an example?

  1. Download and install the WebSockets by MediaMongrels - Toolkit for LabVIEW Download from the VI Package Manager.
    • This will add functions for WebSockets to the Data Communication package.
    • This package was developed by Sam Sharp of MediaMongrels Ltd
  2. In the Package Information page on the VI Package Manager, click "Show Examples."
  3. Open the "WebSockets Examples" project.
  4. Run the SingleConnection VI.
    • When you run this VI, a browser window will open and it will be looking for index.html in the "Test Server" folder. index.html is located in the "Test Client." Change the file path in the URL from "Test Server" to "Test Client."
    • While running, you can send data from the client to the server and vice versa.

Additional Information

WebSocket is a TCP protocol different from HTTP that facilitates real-time communication between a client and a server. Please take note that the LabVIEW Toolkit for Websocket is developed by MediaMongrels and is not supported by NI. Support is provided for free at GitHub repository for LabVIEW Websocket API and by MediaMongrels Ltd.