Runs on different ports, uses wss if URL is https.

master
Luka Vandervelden 5 years ago
parent f0295031e9
commit 00badeaf63

@ -358,7 +358,13 @@ model = {
projects-list: []
}
socket = new WebSocket "ws://localhost:8888/socket"
protocol = if location.protocol == 'https' then 'wss' else 'ws'
port = if location.port then \: + location.port else ''
socket-url = protocol + '://' + location.hostname + port + "/socket"
console.log socket-url
socket = new WebSocket socket-url
socket.onopen = (event) ->
# Nothing to do here ATM.

@ -30,11 +30,13 @@ get "/" do
File.read "index.html"
end
get "/style.css" do
get "/style.css" do |env|
env.response.content_type = "text/css"
File.read "style.css"
end
get "/main.js" do
get "/main.js" do |env|
env.response.content_type = "text/javascript"
File.read "main.js"
end

Loading…
Cancel
Save