Skip to content

Commit

Permalink
Fix JS frotend
Browse files Browse the repository at this point in the history
  • Loading branch information
faustinoaq committed Dec 8, 2017
1 parent 7801270 commit a8b52f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions k.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require "kemal"

require "./src/kemal-watcher"

get "/" do
end

Kemal.watch("./*")

Kemal.run
4 changes: 2 additions & 2 deletions src/kemal-watcher/watcher_handler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module Kemal
if ('WebSocket' in window) {
(() => {
var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
var address = protocol + window.location.host + window.location.pathname + `/#{WEBSOCKETPATH}`;
var socket = new WebSocket(address);
var address = protocol + window.location.host + window.location.pathname + `#{WEBSOCKETPATH}`;
var ws = new WebSocket(address);
ws.onopen = () => {
console.log("Connected to kemal-watcher");
};
Expand Down

0 comments on commit a8b52f8

Please sign in to comment.