summaryrefslogtreecommitdiff
path: root/examples/webchannel/standalone/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'examples/webchannel/standalone/index.html')
-rw-r--r--examples/webchannel/standalone/index.html22
1 files changed, 9 insertions, 13 deletions
diff --git a/examples/webchannel/standalone/index.html b/examples/webchannel/standalone/index.html
index b5a9a49..7c042cd 100644
--- a/examples/webchannel/standalone/index.html
+++ b/examples/webchannel/standalone/index.html
@@ -5,8 +5,7 @@
<script type="text/javascript" src="./qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
- function output(message)
- {
+ function output(message) {
var output = document.getElementById("output");
output.innerHTML = output.innerHTML + message + "\n";
}
@@ -19,20 +18,17 @@
output("Connecting to WebSocket server at " + baseUrl + ".");
var socket = new WebSocket(baseUrl);
- socket.onclose = function()
- {
+ socket.onclose = function() {
console.error("web channel closed");
};
- socket.onerror = function(error)
- {
+ socket.onerror = function(error) {
console.error("web channel error: " + error);
};
- socket.onopen = function()
- {
+ socket.onopen = function() {
output("WebSocket connected, setting up QWebChannel.");
new QWebChannel(socket, function(channel) {
- // make dialog object accessible globally
- window.dialog = channel.objects.dialog;
+ // make core object accessible globally
+ window.core = channel.objects.core;
document.getElementById("send").onclick = function() {
var input = document.getElementById("input");
@@ -43,14 +39,14 @@
output("Sent message: " + text);
input.value = "";
- dialog.receiveText(text);
+ core.receiveText(text);
}
- dialog.sendText.connect(function(message) {
+ core.sendText.connect(function(message) {
output("Received message: " + message);
});
- dialog.receiveText("Client connected, ready to send/receive messages!");
+ core.receiveText("Client connected, ready to send/receive messages!");
output("Connected to WebChannel, ready to send/receive messages!");
});
}