var url = "http://robertnyman.com",
title = "My blog",
state = {
address : url
};
window.history.pushState(state, title, url);
Slide 43
Slide 43 text
No content
Slide 44
Slide 44 text
Web Sockets
Slide 45
Slide 45 text
What came before WebSockets?
Cross Frame Communication
HTTP Polling
LiveConnect
Forever Frame
AJAX
HTTP Long-Polling and XHR Streaming
Slide 46
Slide 46 text
var ws = new WebSocket("ws://robertnyman.com/wsmagic");
// Send data
ws.send("Some data");
// Close the connection
ws.close();
Slide 47
Slide 47 text
var ws = new WebSocket("ws://robertnyman.com/wsmagic");
// When connection is opened
ws.onopen = function () {
console.log("Connection opened!");
};
// When you receive a message
ws.onmessage = function (evt) {
console.log(evt.data);
};
// When you close the connection
ws.onclose = function () {
console.log("Connection closed");
};
// When an error occurred
ws.onerror = function () {
console.log("An error occurred");
};