-exit 0;
-
-
-__DATA__
-@@ index.html.ep
-<!DOCTYPE html>
-<html>
- <head><title>DWeather</title></head>
- <body>
- <script>
- var ws;
- if ("WebSocket" in window) {
- ws = new WebSocket('<%= url_for('index')->to_abs %>');
- //ws = new WebSocket();
- }
- if(typeof(ws) !== 'undefined') {
- ws.onmessage = function (event) {
- document.body.innerHTML += JSON.parse(event.data).test;
- };
- ws.onopen = function (event) {
- ws.send(JSON.stringify({weather: 'WebSocket support works! ♥'}));
- };
- }
- else {
- document.body.innerHTML += 'Browser does not support WebSockets.';
- }