Permalink
Browse files

use wss:// in production

1 parent 0f5fc0e commit 9b4d0b6866c86e88dd5edc9daa9cbee389a995e8 @hone hone committed Oct 8, 2013
Showing with 7 additions and 1 deletion.
  1. +6 −0 app.rb
  2. +1 −1 public/assets/js/application.js → views/application.js.erb
View
6 app.rb
@@ -5,5 +5,11 @@ class App < Sinatra::Base
get "/" do
erb :"index.html"
end
+
+ get "/assets/js/application.js" do
+ content_type :js
+ @scheme = ENV['RACK_ENV'] == "production" ? "wss://" : "ws://"
+ erb :"application.js"
+ end
end
end
@@ -1,4 +1,4 @@
-var scheme = "ws://";
+var scheme = "<%= @scheme %>";
var uri = scheme + window.document.location.host + "/";
var ws = new WebSocket(uri);
ws.onmessage = function(message) {

0 comments on commit 9b4d0b6

Please sign in to comment.