Allows the communication between Usine and a Web Browser, for example to send commands to Usine from a web page or create a Web server inside Usine.
Web Socket port, 8000 by default.
String to send to the connected Web page.
Precess the send operation.
String received from the Wed page.
Sends a trigger when a string is received.
Optional, file sent as a response of the Web Socket. Can be an html, php, js, etc. For example you can create a script to communicate with Usine, like the file webSocketExample.html:
<!DOCTYPE HTML>
<html>
<head>
<title>WebSocket demo</title>
<script type="text/javascript">
var ws;
function log(s)
{
document.getElementById("log").innerHTML += s + "\n";
}
function sendMessage(s)
{
log(">> " + s);
ws.send(s);
}
function send()
{
sendMessage(document.getElementById("text").value);
}
function init()
{
ws = new WebSocket("ws://localhost:8000"); // should be the IP address of Usine
ws.onopen = function()
{
log("WebSocket opened");
sendMessage("Hello ?");
}
ws.onclose = function()
{
log("WebSocket closed")
}
ws.onmessage = function(e)
{
log("<< " + e.data)
}
}
</script>
</head>
<body onLoad="init()">
<input type="text" id="text">
<button onclick="send()">Send</button>
<pre id="log"></pre>
</body>
</html>
This file is optional because it can be stored on the distant server.
Response as string of the Web Socket on connection.
send 1 value when the socket is connected.
Display all received messages in the trace-panel.
Opens the localhost page (http://127.0.0.1:8000 by default) in the Web Browser in order to test the communication and the response file.
version 5.2.221206
Edit All Pages