Posts

LabVIEW WebSockets API – now Open-Source!

MediaMongrels Ltd are pleased to announce that we have taken the decision to make the LabVIEW WebSockets API Open-Source and the source is now available on GitHub.

Background

I was at NI Days Europe last week – mostly there to talk about LabVIEW WebVIs, show off my DemocracyBot and help out with the LabVIEW Community Booth (Short version: Great success!). I’ll post more about my time there in another post but the last session I went to on the Thursday was from Joerg Hampel (Hampel Software Engineering) and James McNally (Wiresmith Technology) on Open-Source projects.

Suit-wearing PC (Inner-Source) vs Hipster Mac (Open-Source)

Their session was to encourage LabVIEW developers to make their projects Open-Source and they showed a practical example of using GitHub to make a contribution to an Open-Source project – in this case the excellent G-CLI toolkit.

Suit-wearing PC (Joerg) vs ‘Hipster’ James M(a)c.
Photo Credit: Dani Jobe (@DaniJoeb)

You can access their presentation by clicking the button below:

I was so inspired by their excellent talk and NI’s decision to create the free LabVIEW Community Edition that I have decided to put the LabVIEW WebSockets API on GitHub and make it Open-Source (still under the MIT license).

WebSockets API on GitHub

You can access the public GitHub repository for the WebSockets library by hitting the button below:

I’ll also be using GitHub in future for support and issue tracking with the library – you’ll be able to see whether issues have already been reported and see progress on adding new features.

You’ll also get immediate access to new releases by downloading the VI Package from the releases page – I will still be publishing the packages to the NI Tools Network.

You’ll also be able to fork the library and contribute towards fixing issues and implementing new features.

Secure WebSockets (wss://) and LabVIEW NXG Support

If you’ve checked out the GitHub repository, you’ll see there’s already a couple of issues in there regarding support for Secure WebSockets (wss://) and LabVIEW NXG.

NI Days 2019 slide on the WebSockets API

Feel free to sign up for updates/notifications on those issues – with NI’s announcement that SSL/TLS support is coming to the TCP/IP VIs in LabVIEW 2020 I’ll be aiming to update the library to support Secure WebSockets in line with the LabVIEW 2020 release. Once these new functions are available in the LabVIEW 2020 Beta I will begin working on adding them to the WebSockets library.

Open-Source all the things!

In the coming weeks, I’ll be moving over all of my Raspberry Pi / LINX code over to the MediaMongrels Ltd GitHub account as well. You’ll be able to find a list of all projects

I encourage you to have a look at their presentation if you get the chance and also to contribute to Open-Source LabVIEW projects. I feel like GCentral is going to play an important part in finding reusable libraries and Open-Source projects in future.

Of course, if you see our open source code & projects and want to support them – the best way to do that is to hire us to work for you on your projects! Get in touch and see how we can help you with your LabVIEW Software and WebSockets applications.

Version 2.0 of the LabVIEW™ WebSockets API now available!

WebSockets API V2.0 now available!

MediaMongrels Ltd are pleased to announce the release of Version 2.0 of the LabVIEW™ WebSockets API on the LabVIEW Tools Network. This new version of the WebSockets API is the first major rewrite since its initial release and includes new features and some bug fixes.

Overview

  • Now with more objects! The library has moved to a simpler, object-oriented API to better distinguish between client/server connections. The underlying TCP/IP functionality has been replaced with a ‘Socket’ abstraction that includes socket client/server and socket listener classes with implementations for the NI VISA TCP/IP functions.
  • Read / Write VIs: The read/write VIs now handle text and binary data frames, ping/pong frames and fragmented messages.
  • Documentation: The library is now certified under the LabVIEW Tools Network program and includes detailed help documentation available from the LabVIEW help menu (Help -> MediaMongrels Ltd -> WebSockets API) as well as including a WebSockets Client Example for connection to 3rd party WebSockets Servers.
  • Paving the way for Secure WebSockets and LabVIEW NXG Support: The V2.X library rewrite paves the way for LabVIEW NXG support. The new Socket abstraction allows the NI VISA TCP/IP functions to be replaced

Full release on the LabVIEW™ Tools Network

The new version of the library has now been certified for the LabVIEW™ Tools Network – you can download the latest version from VI Package Manager here: Install LabVIEW WebSockets API (VIPM)

Screenshots

The screenshots below show the new API for a client and a server connection respectively.

Client API

Server API

Legacy API

Due to the rewrite, the new API breaks backwards compatibility with the previous version of the library. To minimise disruption when upgrading, Legacy API functions are included in the library. With the Legacy API, the VI calls remain the same as previous versions but the TCP/IP refnum wire has been replaced with a WebSockets API connection reference. Compare the Pre-V2.X to the V2.X Legacy API below.

WebSockets API Upgrade to V2.X with Legacy API functions

Release Notes

Major rewrite of the WebSockets library:
– New: Moved library to an OO approach for WebSockets connections (Client/Server Classes)
– New: Abstracted underlying socket functionality (e.g. NI VISA TCP) for future secure WebSockets support
– New: Added TCP socket listener for listening for server socket connections
– New: Simplified API
– New: Added high-level Read function which internally handles fragmented and Ping frames
– New: Added WebSockets Client Example VI and modified examples to use new classes
– New: Added unit testing to source repository
– New: Added detailed documentation (.chm file) to LabVIEW Help menu and added examples to NI Example Finder
– New: Added palette support for LV2020
– Fix: Fixed incorrectly applied timeout values (timeout = approx. maximum time until VI returns)
– Fix: WebSocket-Client-Key is now correctly generated as a random string rather than being a constant

Note: A backwards compatibility layer is retained for legacy applications allowing upgrade with minimal application changes. It is strongly recommended to update applications to use the new library VIs.