Code Monkey home page Code Monkey logo

labview-websockets-api's Introduction

LabVIEW-WebSockets-API

MediaMongrels Ltd LabVIEW WebSockets API on the NI Tools Network.

Product Homepage

https://www.mediamongrels.com/labview-websockets-api/

LabVIEW Version

The library source is written in LabVIEW 2013.

Installation

The library can be installed using one of the following methods:

  1. Download and install the VI Package from the Releases Tab in GitHub
  2. Download the Toolkit from the NI Tools Network - http://sine.ni.com/nips/cds/view/p/lang/en/nid/217850
  3. Find and install the package directly from VI Package Manager

License

The source code is available under the MIT License.

Documentation

Help documentation is installed with the VI Package - access it from the Help menu in LabVIEW.

Examples

Examples are included in the package and accessible from the LabVIEW Example Finder.

Support & Contributions

  • Limited free support is available from MediaMongrels Ltd and via the GitHub repo. Paid support is available - contact for details ([email protected]).
  • Feel free to fork and create a pull request to improve the library by fixing issues. All submissions must follow the requirements for NI Tools Network products.

Donations

If you wish to support and share your gratitude for this library then donations are warmly received. PayPal donations can be sent to [email protected]

labview-websockets-api's People

Contributors

francois-normandin avatar samsharp99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

labview-websockets-api's Issues

Socket Read / Write don't use the Socket property

The WebSocket.lvclass:Socket Read.vi and WebSocket.lvclass:Socket Write.vi don't use the Socket property which already exists for the class. If it used the property nodes, it would make it more consistent and easier to track down changes to the socket (changes only occur in one VI).

Websocket read

Hi I'm using this very nice library

to write a data, millions data, to check connection, to reconnect, everything works perfect.
But to receive the data, I have a issue and I cannot solve it. it works only for 10 min and then instead of arrive data and go to code 0 it stays on code 56 and even if I try to read on 56 I read nothing. the connection is still good.
What I have to do?

Could anyone help me please?

thanks
Rafael

Add closing codes and reasons

The webocket protocol states that a reason can be given by the endpoint, when sending a closing frame. It should be a two byte code (1000 for "everything is fine") followed by an optional utf-8 encoded message. Python's websockets server generates an error, when no code is sent, assuming something went wrong.
It would be good to send a confirmation that closing was expected.
I could fix my issue by changing the "close frame.vi" as follows:
image
Download (valid until 2020-01-31)

I would recommend to make the Ring Menu into a Control and use it as an optional input. Then one can program a client that automatically closes the connection with the correct error code, when e.g. a binary payload instead of an expected text payload is received.

Handshake header should do a case-insensitive match

I was experimenting with MQTT over Websockets this weekend and my local server would connect fine, but fail to connect to HiveMQ's online broker with error 52 (invalid handshake). I traced the issue to a case insensitive header response from the HiveMQ broker.
Although this is very unusual, RFC 2616 does state that all HTTP headers should be matched regardless of case sensitivity.

image

For example, the server's response was of this sort:

HTTP/1.1 101 Switching Protocols
upgrade: websocket
connection: upgrade
sec-websocket-accept: +he/auQq5ZNFUZ2w0qtJugDEhbI=

I have not given much thoughts on the impact of storing the headers in lowercase all the time, but a quick test worked for me.
Perhaps the fix is as simple as this:
image

WSS:// not working

Hello, Thanks for the great code. It works with echo server using ws, but not wss.
image
Any suggestions?

Infinite loop on Read when no connection (default socket)

In testing for Websockets and standard TCP error code comparisons, I've run into an infinite loop when I purposefully perform a read on a default socket.

I should not be trying to read from a Websocket if there is no connection (listener timed out) but running the test below on a TCP read would simply return "Error 1: Invalid argument".

image
In the screenshot above, the probe on (33) shows that the Websocket is default value and the socket object is of type "Socket.lvclass". I entered an infinite loop where the Internal Read would time out, but be floored at 0ms and repeat itself without stopping. The workaround was to ensure that I had a TCP socket in my default Websocket object, even though the TCP connection ID is invalid.

I believe it should terminate the loop when the timeout for the Calculate Timeout method (outside the loop) is Elasped = True, before getting into the loop and actually waiting for frames.

image

An equivalent TCP operation would be a 0ms timeout on the Read method... Even if there are bytes (frames) on the bus, it should return immediately.

Add LabVIEW NXG Support

To add WebSockets Client/Server support for LabVIEW NXG.

WebSockets support has already been added to the NXG Web Module but the corresponding functionality has not been implemented for 'regular' LabVIEW NXG.

This will require importing the 'classic' LabVIEW library and building it into an NI Package.

Improve Base64 encode/decode performance

For large packet sizes (>1Mb), the Base64 encode/decode functions are not performant.

Investigate and see if improvements can be made to increase library performance.

Add Secure WebSockets (wss://) support

The current implementation of the library uses the native LabVIEW TCP/IP VIs which do not support TLS/SSL communications required for Secure WebSockets.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.