WebSockets bytran communication over the Internet

Stating with version 1.3 it will be possible to remotely control and retrieve the results of bytran calculations over the Internet or local network (i.e. for devices connected to the same router).   Such data exchange and control are carried out using the WebSockets protocol.   When the "WiFi / Ethernet" option is enabled under the "Connect" option of the main menu, bytran will start a WebSockets server.   To initiate the communication it is necessary to open a client connection to the device running bytran with the "WiFi / Ethernet" option enabled.   Bytran does not currently support client WebSockets connection (i.e. it can be connected to but cannot connect to a remote WebSockets server).

The WebSockets communication protocol based communication is easy to implement using a variety of programming languages including JavaScript and HTML5.   A simple example web-based interface to demonstrate communication with bytran using WebSockets from within the web browser is provided below.   It can be used to test the bytran WebSockets communication functionality by following the instructions below.

1)   Start bytran on one device and open this webpage on a different device.   Make sure both devices are connected to the Internet or a local area network (i.e. connected to the same WiFi router).
2)   Within the bytran program go to "Menu" / "Connect" (see Figure 1 on this page) and select the "WiFi / Ethernet option"
3)   Under "Menu" / "Connect" - "WiFi / Ethernet option" (see example in Figure 2 on this page) take a note of the device IP address under "Your active IP address(es)" to be used by the WebSocket client.
4)   Type in "Your active IP address" into the "ip address of the device:" field on this page
5)   Make sure that the "port number" value on this page is the same as that under the "WiFi / Ethernet" option in the bytran program (see Figure 2 and 3 on this page for an example)
6)   Click the "Connect" button on this page. If the connection is successfull you will receive a "CONNECTED" message in the "data exchange log"
7)   Type in the desired bytran command and the paramter values into the "Text to send" field on this page according to the bytran communication protocol and press the "Send" button.   For example, sending "#CALC" (the commands don't have to be capitalized) will start a calculation with the currently set parameters.   Sending "#RESULT;SPEC;0" will return the high resolution total spectrum for the last calculation performed.   If the "Broadcast manual input" option is enabled, the manual change of parameters in the bytran program will result in the corresponding commands being sent to the connected device (i.e. the web form below).

ip address of the device
  port number
:  
   
data exchange log:
Text to send:
This web-based WebSockets communication form was based on this example.



WebSockets setup in bytran 1.3

The IP addresses shown in Figure 2 will be different depending on your hardware setup and the WiFi / Ethernet connection


www.bytran.org -|- 2018