highcarb 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,7 @@ module HighCarb
28
28
 
29
29
  opt "http-port", "HTTP server port", default: 9090
30
30
  opt "ws-port", "WebSockets port", default: 9091
31
+ opt "ws", "Enable/Disable WebSockets", default: true
31
32
 
32
33
  opt "skip-libs", "Don't download vendor libraries, like Deck.js and jQuery"
33
34
 
@@ -11,8 +11,10 @@ module HighCarb
11
11
 
12
12
  def start!(command, logger, auth)
13
13
  EM.run do
14
- EM::WebSocket.start(host: '0.0.0.0', port: command.options["ws-port"] ) do |websocket|
15
- WSConnection.new websocket, logger
14
+ if command.options["ws"]
15
+ EM::WebSocket.start(host: '0.0.0.0', port: command.options["ws-port"] ) do |websocket|
16
+ WSConnection.new websocket, logger
17
+ end
16
18
  end
17
19
 
18
20
  Thin::Server.start(
@@ -1,3 +1,3 @@
1
1
  module HighCarb
2
- Version = "0.2.1"
2
+ Version = "0.2.2"
3
3
  end
@@ -14,6 +14,11 @@ $ ->
14
14
  # we can receive commands to change the current slide
15
15
  toJson = JSON.stringify
16
16
 
17
+
18
+ # Don't initialize the websocket if we don't have any URL
19
+ return unless EnableWebSocketsURL
20
+
21
+
17
22
  channel = new WebSocket WebSocketsURL
18
23
  channel.onmessage = (msgEvent) ->
19
24
  msg = JSON.parse(msgEvent.data)
@@ -15,6 +15,7 @@
15
15
  %script{ src: "/assets/vendor/deck.js/extensions/hash/deck.hash.js" }
16
16
 
17
17
  :javascript
18
+ window.EnableWebSocketsURL = #{!!options["no-ws"]};
18
19
  window.WebSocketsURL = "ws://" + location.hostname + ":#{options["ws-port"].to_json}/";
19
20
 
20
21
  = load_coffe "index"
@@ -2,6 +2,9 @@
2
2
  window.WebSocket = MozWebSocket if MozWebSocket?
3
3
 
4
4
  $ ->
5
+ # Don't initialize the websocket if we don't have any URL
6
+ return unless EnableWebSocketsURL
7
+
5
8
  $(".slides").
6
9
  load("/slides").
7
10
  delegate(".slide", "click", (event) ->
@@ -54,6 +54,7 @@
54
54
  .slides Loading ...
55
55
 
56
56
  :javascript
57
+ window.EnableWebSocketsURL = #{!!options["ws"]};
57
58
  window.WebSocketsURL = "ws://" + location.hostname + ":#{options["ws-port"].to_json}/";
58
59
 
59
60
  = load_coffe "remote"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highcarb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: