Posts

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.