VT Anywhere was created the ease of embedding in mind. This means that adding VT functionality to an existing application is simple. To achieve this, there are a few system level requirements:
Must have a HTTP connection between the host and your application
Must have a JavaScript and Web-socket capable browser in your application
For example, the server can run off a RaspberryPi, and the UI can run on an iPad using a WKWebView embedded into an iOS application.
This will run the server application on port 8000. To keep this example simple, the VT server will be run on a Windows PC.
VT Anywhere should be run from the command line (cmd.exe) on Windows or any terminal emulator on Linux. Running the server requires a command line argument to tell it which type of adapter is connected. Valid options are:
--udp [for use with the virtual bus]
--pcan [on Windows for use with a Peak USB adapter]
--socketcan [on Linux for use with SocketCAN]
If running on Linux, an extra argument can be added after --socketcan to specify the CAN bus is desired. For example, --socketcan can1. By default, can0 is used.
Once a CAN adapter has been configured, run vt-anywhere.exe. The following should be seen in the command window:
[2018-07-19][09:00:57][can_udp][DEBUG] Connecting to UDP network
[2018-07-19][09:00:57][vt_st::name_table][DEBUG] Requesting address claims
[2018-07-19][09:00:57][vt_st::upstream][DEBUG] Listening for websocket connections
[2018-07-19][09:00:57][vt_st::name_table][DEBUG] Sending my address claim
[2018-07-19][09:00:57][vt_st::name_table][DEBUG] address claimed
Listening on http://0.0.0.0:8000
Ctrl-C to shutdown server
[2018-07-19][09:00:58][vt_st::name_table][DEBUG] Finished waiting for address claim responses. name table: {}
[2018-07-19][09:00:58][vt_st::name_table][DEBUG] address claimed
On a PC, open a web browser and navigate to localhost:8000 to see the VT running.
After the VT is set up, web browser control needs to be added to an application. The following is a tutorial on setting up WKWebView: https://www.hackingwithswift.com/read/4/2/creating-a-simple-browser-with-wkwebview.
If using that tutorial, make sure to disable navigation:
webView.allowsBackForwardNavigationGestures = false