websocket-rails 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +32 -0
  3. data/Gemfile +2 -1
  4. data/README.md +29 -34
  5. data/lib/assets/javascripts/websocket_rails/abstract_connection.js.coffee +45 -0
  6. data/lib/assets/javascripts/websocket_rails/channel.js.coffee +34 -17
  7. data/lib/assets/javascripts/websocket_rails/event.js.coffee +13 -11
  8. data/lib/assets/javascripts/websocket_rails/http_connection.js.coffee +44 -45
  9. data/lib/assets/javascripts/websocket_rails/main.js +1 -0
  10. data/lib/assets/javascripts/websocket_rails/websocket_connection.js.coffee +20 -34
  11. data/lib/assets/javascripts/websocket_rails/websocket_rails.js.coffee +60 -15
  12. data/lib/generators/websocket_rails/install/templates/websocket_rails.rb +15 -0
  13. data/lib/rails/config/routes.rb +1 -1
  14. data/lib/rails/tasks/websocket_rails.tasks +6 -2
  15. data/lib/websocket_rails/channel.rb +28 -2
  16. data/lib/websocket_rails/channel_manager.rb +16 -0
  17. data/lib/websocket_rails/configuration.rb +26 -1
  18. data/lib/websocket_rails/connection_adapters/http.rb +7 -0
  19. data/lib/websocket_rails/connection_adapters/web_socket.rb +3 -1
  20. data/lib/websocket_rails/connection_manager.rb +1 -1
  21. data/lib/websocket_rails/controller_factory.rb +1 -1
  22. data/lib/websocket_rails/event.rb +9 -2
  23. data/lib/websocket_rails/logging.rb +0 -1
  24. data/lib/websocket_rails/synchronization.rb +11 -7
  25. data/lib/websocket_rails/version.rb +1 -1
  26. data/spec/javascripts/generated/assets/abstract_connection.js +71 -0
  27. data/spec/javascripts/generated/assets/channel.js +58 -34
  28. data/spec/javascripts/generated/assets/event.js +12 -16
  29. data/spec/javascripts/generated/assets/http_connection.js +67 -65
  30. data/spec/javascripts/generated/assets/websocket_connection.js +36 -51
  31. data/spec/javascripts/generated/assets/websocket_rails.js +68 -21
  32. data/spec/javascripts/generated/specs/channel_spec.js +102 -19
  33. data/spec/javascripts/generated/specs/helpers.js +17 -0
  34. data/spec/javascripts/generated/specs/websocket_connection_spec.js +72 -19
  35. data/spec/javascripts/generated/specs/websocket_rails_spec.js +146 -47
  36. data/spec/javascripts/support/jasmine.yml +10 -2
  37. data/spec/javascripts/support/jasmine_helper.rb +38 -0
  38. data/spec/javascripts/websocket_rails/channel_spec.coffee +66 -12
  39. data/spec/javascripts/websocket_rails/event_spec.coffee +7 -7
  40. data/spec/javascripts/websocket_rails/helpers.coffee +6 -0
  41. data/spec/javascripts/websocket_rails/websocket_connection_spec.coffee +53 -15
  42. data/spec/javascripts/websocket_rails/websocket_rails_spec.coffee +108 -25
  43. data/spec/unit/base_controller_spec.rb +41 -0
  44. data/spec/unit/channel_manager_spec.rb +21 -0
  45. data/spec/unit/channel_spec.rb +43 -3
  46. data/spec/unit/connection_adapters/http_spec.rb +24 -3
  47. data/spec/unit/connection_adapters_spec.rb +2 -2
  48. data/spec/unit/connection_manager_spec.rb +1 -1
  49. data/spec/unit/event_spec.rb +25 -1
  50. data/spec/unit/logging_spec.rb +1 -1
  51. metadata +57 -67
  52. data/spec/javascripts/support/jasmine_config.rb +0 -63
@@ -71,6 +71,11 @@ module WebsocketRails
71
71
  case encoded_data
72
72
  when String
73
73
  event_name, data = JSON.parse encoded_data
74
+
75
+ unless event_name.is_a?(String) && data.is_a?(Hash)
76
+ raise UnknownDataType
77
+ end
78
+
74
79
  data = data.merge(:connection => connection).with_indifferent_access
75
80
  Event.new event_name, data
76
81
  # when Array
@@ -93,7 +98,7 @@ module WebsocketRails
93
98
  include Logging
94
99
  extend StaticEvents
95
100
 
96
- attr_reader :id, :name, :connection, :namespace, :channel, :user_id
101
+ attr_reader :id, :name, :connection, :namespace, :channel, :user_id, :token
97
102
 
98
103
  attr_accessor :data, :result, :success, :server_token
99
104
 
@@ -108,7 +113,8 @@ module WebsocketRails
108
113
  end
109
114
  @id = options[:id]
110
115
  @data = options[:data].is_a?(Hash) ? options[:data].with_indifferent_access : options[:data]
111
- @channel = options[:channel].to_sym if options[:channel]
116
+ @channel = options[:channel].to_sym rescue options[:channel].to_s.to_sym if options[:channel]
117
+ @token = options[:token] if options[:token]
112
118
  @connection = options[:connection]
113
119
  @server_token = options[:server_token]
114
120
  @user_id = options[:user_id]
@@ -125,6 +131,7 @@ module WebsocketRails
125
131
  :data => data,
126
132
  :success => success,
127
133
  :result => result,
134
+ :token => token,
128
135
  :server_token => server_token
129
136
  }
130
137
  ]
@@ -46,7 +46,6 @@ module WebsocketRails
46
46
  message.chomp.split("\n").each do |line|
47
47
  logger.send(level, wrap(level, self, line, options || {}))
48
48
  end
49
- logger << "\n"
50
49
  end
51
50
 
52
51
  def log_event_start(event)
@@ -33,6 +33,10 @@ module WebsocketRails
33
33
  singleton.shutdown!
34
34
  end
35
35
 
36
+ def self.redis
37
+ singleton.redis
38
+ end
39
+
36
40
  def self.singleton
37
41
  @singleton ||= new
38
42
  end
@@ -40,7 +44,10 @@ module WebsocketRails
40
44
  include Logging
41
45
 
42
46
  def redis
43
- @redis ||= Redis.new(WebsocketRails.config.redis_options)
47
+ @redis ||= begin
48
+ redis_options = WebsocketRails.config.redis_options
49
+ EM.reactor_running? ? Redis.new(redis_options) : ruby_redis
50
+ end
44
51
  end
45
52
 
46
53
  def ruby_redis
@@ -52,9 +59,8 @@ module WebsocketRails
52
59
 
53
60
  def publish(event)
54
61
  Fiber.new do
55
- redis_client = EM.reactor_running? ? redis : ruby_redis
56
62
  event.server_token = server_token
57
- redis_client.publish "websocket_rails.events", event.serialize
63
+ redis.publish "websocket_rails.events", event.serialize
58
64
  end.resume
59
65
  end
60
66
 
@@ -157,16 +163,14 @@ module WebsocketRails
157
163
 
158
164
  def find_user(identifier)
159
165
  Fiber.new do
160
- redis_client = EM.reactor_running? ? redis : ruby_redis
161
- raw_user = redis_client.hget('websocket_rails.users', identifier)
166
+ raw_user = redis.hget('websocket_rails.users', identifier)
162
167
  raw_user ? JSON.parse(raw_user) : nil
163
168
  end.resume
164
169
  end
165
170
 
166
171
  def all_users
167
172
  Fiber.new do
168
- redis_client = EM.reactor_running? ? redis : ruby_redis
169
- redis_client.hgetall('websocket_rails.users')
173
+ redis.hgetall('websocket_rails.users')
170
174
  end.resume
171
175
  end
172
176
 
@@ -1,3 +1,3 @@
1
1
  module WebsocketRails
2
- VERSION = "0.6.2"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -0,0 +1,71 @@
1
+
2
+ /*
3
+ Abstract Interface for the WebSocketRails client.
4
+ */
5
+
6
+ (function() {
7
+ WebSocketRails.AbstractConnection = (function() {
8
+ function AbstractConnection(url, dispatcher) {
9
+ this.dispatcher = dispatcher;
10
+ this.message_queue = [];
11
+ }
12
+
13
+ AbstractConnection.prototype.close = function() {};
14
+
15
+ AbstractConnection.prototype.trigger = function(event) {
16
+ if (this.dispatcher.state !== 'connected') {
17
+ return this.message_queue.push(event);
18
+ } else {
19
+ return this.send_event(event);
20
+ }
21
+ };
22
+
23
+ AbstractConnection.prototype.send_event = function(event) {
24
+ if (this.connection_id != null) {
25
+ return event.connection_id = this.connection_id;
26
+ }
27
+ };
28
+
29
+ AbstractConnection.prototype.on_close = function(event) {
30
+ var close_event;
31
+ if (this.dispatcher && this.dispatcher._conn === this) {
32
+ close_event = new WebSocketRails.Event(['connection_closed', event]);
33
+ this.dispatcher.state = 'disconnected';
34
+ return this.dispatcher.dispatch(close_event);
35
+ }
36
+ };
37
+
38
+ AbstractConnection.prototype.on_error = function(event) {
39
+ var error_event;
40
+ if (this.dispatcher && this.dispatcher._conn === this) {
41
+ error_event = new WebSocketRails.Event(['connection_error', event]);
42
+ this.dispatcher.state = 'disconnected';
43
+ return this.dispatcher.dispatch(error_event);
44
+ }
45
+ };
46
+
47
+ AbstractConnection.prototype.on_message = function(event_data) {
48
+ if (this.dispatcher && this.dispatcher._conn === this) {
49
+ return this.dispatcher.new_message(event_data);
50
+ }
51
+ };
52
+
53
+ AbstractConnection.prototype.setConnectionId = function(connection_id) {
54
+ this.connection_id = connection_id;
55
+ };
56
+
57
+ AbstractConnection.prototype.flush_queue = function() {
58
+ var event, _i, _len, _ref;
59
+ _ref = this.message_queue;
60
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
61
+ event = _ref[_i];
62
+ this.trigger(event);
63
+ }
64
+ return this.message_queue = [];
65
+ };
66
+
67
+ return AbstractConnection;
68
+
69
+ })();
70
+
71
+ }).call(this);
@@ -1,3 +1,4 @@
1
+
1
2
  /*
2
3
  The channel object is returned when you subscribe to a channel.
3
4
 
@@ -6,51 +7,53 @@ For instance:
6
7
  var awesome_channel = dispatcher.subscribe('awesome_channel');
7
8
  awesome_channel.bind('event', function(data) { console.log('channel event!'); });
8
9
  awesome_channel.trigger('awesome_event', awesome_object);
9
- */
10
-
10
+ */
11
11
 
12
12
  (function() {
13
13
  var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
14
14
 
15
15
  WebSocketRails.Channel = (function() {
16
- function Channel(name, _dispatcher, is_private) {
17
- var event, event_name;
16
+ function Channel(name, _dispatcher, is_private, on_success, on_failure) {
17
+ var event, event_name, _ref;
18
18
  this.name = name;
19
19
  this._dispatcher = _dispatcher;
20
- this.is_private = is_private;
20
+ this.is_private = is_private != null ? is_private : false;
21
+ this.on_success = on_success;
22
+ this.on_failure = on_failure;
21
23
  this._failure_launcher = __bind(this._failure_launcher, this);
22
24
  this._success_launcher = __bind(this._success_launcher, this);
23
- this.dispatch = __bind(this.dispatch, this);
24
- this.trigger = __bind(this.trigger, this);
25
- this.bind = __bind(this.bind, this);
26
- this.destroy = __bind(this.destroy, this);
25
+ this._callbacks = {};
26
+ this._token = void 0;
27
+ this._queue = [];
27
28
  if (this.is_private) {
28
29
  event_name = 'websocket_rails.subscribe_private';
29
30
  } else {
30
31
  event_name = 'websocket_rails.subscribe';
31
32
  }
33
+ this.connection_id = (_ref = this._dispatcher._conn) != null ? _ref.connection_id : void 0;
32
34
  event = new WebSocketRails.Event([
33
35
  event_name, {
34
36
  data: {
35
37
  channel: this.name
36
38
  }
37
- }, this._dispatcher.connection_id
39
+ }, this.connection_id
38
40
  ], this._success_launcher, this._failure_launcher);
39
41
  this._dispatcher.trigger_event(event);
40
- this._callbacks = {};
41
42
  }
42
43
 
43
44
  Channel.prototype.destroy = function() {
44
- var event, event_name;
45
- event_name = 'websocket_rails.unsubscribe';
46
- event = new WebSocketRails.Event([
47
- event_name, {
48
- data: {
49
- channel: this.name
50
- }
51
- }, this._dispatcher.connection_id
52
- ]);
53
- this._dispatcher.trigger_event(event);
45
+ var event, event_name, _ref;
46
+ if (this.connection_id === ((_ref = this._dispatcher._conn) != null ? _ref.connection_id : void 0)) {
47
+ event_name = 'websocket_rails.unsubscribe';
48
+ event = new WebSocketRails.Event([
49
+ event_name, {
50
+ data: {
51
+ channel: this.name
52
+ }
53
+ }, this.connection_id
54
+ ]);
55
+ this._dispatcher.trigger_event(event);
56
+ }
54
57
  return this._callbacks = {};
55
58
  };
56
59
 
@@ -67,24 +70,35 @@ For instance:
67
70
  event = new WebSocketRails.Event([
68
71
  event_name, {
69
72
  channel: this.name,
70
- data: message
71
- }, this._dispatcher.connection_id
73
+ data: message,
74
+ token: this._token
75
+ }, this.connection_id
72
76
  ]);
73
- return this._dispatcher.trigger_event(event);
77
+ if (!this._token) {
78
+ return this._queue.push(event);
79
+ } else {
80
+ return this._dispatcher.trigger_event(event);
81
+ }
74
82
  };
75
83
 
76
84
  Channel.prototype.dispatch = function(event_name, message) {
77
- var callback, _i, _len, _ref, _results;
78
- if (this._callbacks[event_name] == null) {
79
- return;
80
- }
81
- _ref = this._callbacks[event_name];
82
- _results = [];
83
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
84
- callback = _ref[_i];
85
- _results.push(callback(message));
85
+ var callback, _i, _len, _ref, _ref1, _results;
86
+ if (event_name === 'websocket_rails.channel_token') {
87
+ this.connection_id = (_ref = this._dispatcher._conn) != null ? _ref.connection_id : void 0;
88
+ this._token = message['token'];
89
+ return this.flush_queue();
90
+ } else {
91
+ if (this._callbacks[event_name] == null) {
92
+ return;
93
+ }
94
+ _ref1 = this._callbacks[event_name];
95
+ _results = [];
96
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
97
+ callback = _ref1[_i];
98
+ _results.push(callback(message));
99
+ }
100
+ return _results;
86
101
  }
87
- return _results;
88
102
  };
89
103
 
90
104
  Channel.prototype._success_launcher = function(data) {
@@ -99,6 +113,16 @@ For instance:
99
113
  }
100
114
  };
101
115
 
116
+ Channel.prototype.flush_queue = function() {
117
+ var event, _i, _len, _ref;
118
+ _ref = this._queue;
119
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
120
+ event = _ref[_i];
121
+ this._dispatcher.trigger_event(event);
122
+ }
123
+ return this._queue = [];
124
+ };
125
+
102
126
  return Channel;
103
127
 
104
128
  })();
@@ -1,28 +1,21 @@
1
+
1
2
  /*
2
3
  The Event object stores all the relevant event information.
3
- */
4
-
4
+ */
5
5
 
6
6
  (function() {
7
- var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
8
-
9
7
  WebSocketRails.Event = (function() {
10
8
  function Event(data, success_callback, failure_callback) {
11
9
  var attr;
12
10
  this.success_callback = success_callback;
13
11
  this.failure_callback = failure_callback;
14
- this.run_callbacks = __bind(this.run_callbacks, this);
15
- this.attributes = __bind(this.attributes, this);
16
- this.serialize = __bind(this.serialize, this);
17
- this.is_ping = __bind(this.is_ping, this);
18
- this.is_result = __bind(this.is_result, this);
19
- this.is_channel = __bind(this.is_channel, this);
20
12
  this.name = data[0];
21
13
  attr = data[1];
22
14
  if (attr != null) {
23
15
  this.id = attr['id'] != null ? attr['id'] : ((1 + Math.random()) * 0x10000) | 0;
24
16
  this.channel = attr.channel != null ? attr.channel : void 0;
25
17
  this.data = attr.data != null ? attr.data : attr;
18
+ this.token = attr.token != null ? attr.token : void 0;
26
19
  this.connection_id = data[2];
27
20
  if (attr.success != null) {
28
21
  this.result = true;
@@ -36,7 +29,7 @@ The Event object stores all the relevant event information.
36
29
  };
37
30
 
38
31
  Event.prototype.is_result = function() {
39
- return this.result === true;
32
+ return typeof this.result !== 'undefined';
40
33
  };
41
34
 
42
35
  Event.prototype.is_ping = function() {
@@ -51,15 +44,18 @@ The Event object stores all the relevant event information.
51
44
  return {
52
45
  id: this.id,
53
46
  channel: this.channel,
54
- data: this.data
47
+ data: this.data,
48
+ token: this.token
55
49
  };
56
50
  };
57
51
 
58
- Event.prototype.run_callbacks = function(success, data) {
59
- if (success === true) {
60
- return typeof this.success_callback === "function" ? this.success_callback(data) : void 0;
52
+ Event.prototype.run_callbacks = function(success, result) {
53
+ this.success = success;
54
+ this.result = result;
55
+ if (this.success === true) {
56
+ return typeof this.success_callback === "function" ? this.success_callback(this.result) : void 0;
61
57
  } else {
62
- return typeof this.failure_callback === "function" ? this.failure_callback(data) : void 0;
58
+ return typeof this.failure_callback === "function" ? this.failure_callback(this.result) : void 0;
63
59
  }
64
60
  };
65
61
 
@@ -1,15 +1,22 @@
1
+
1
2
  /*
2
3
  HTTP Interface for the WebSocketRails client.
3
- */
4
-
4
+ */
5
5
 
6
6
  (function() {
7
- var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
7
+ var __hasProp = {}.hasOwnProperty,
8
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
9
+
10
+ WebSocketRails.HttpConnection = (function(_super) {
11
+ __extends(HttpConnection, _super);
8
12
 
9
- WebSocketRails.HttpConnection = (function() {
10
- HttpConnection.prototype.httpFactories = function() {
13
+ HttpConnection.prototype.connection_type = 'http';
14
+
15
+ HttpConnection.prototype._httpFactories = function() {
11
16
  return [
12
17
  function() {
18
+ return new XDomainRequest();
19
+ }, function() {
13
20
  return new XMLHttpRequest();
14
21
  }, function() {
15
22
  return new ActiveXObject("Msxml2.XMLHTTP");
@@ -21,93 +28,88 @@
21
28
  ];
22
29
  };
23
30
 
24
- HttpConnection.prototype.createXMLHttpObject = function() {
25
- var e, factories, factory, xmlhttp, _i, _len;
26
- xmlhttp = false;
27
- factories = this.httpFactories();
28
- for (_i = 0, _len = factories.length; _i < _len; _i++) {
29
- factory = factories[_i];
30
- try {
31
- xmlhttp = factory();
32
- } catch (_error) {
33
- e = _error;
34
- continue;
35
- }
36
- break;
37
- }
38
- return xmlhttp;
39
- };
40
-
41
31
  function HttpConnection(url, dispatcher) {
42
- this.url = url;
32
+ var e;
43
33
  this.dispatcher = dispatcher;
44
- this.connectionClosed = __bind(this.connectionClosed, this);
45
- this.flush_queue = __bind(this.flush_queue, this);
46
- this.trigger = __bind(this.trigger, this);
47
- this.parse_stream = __bind(this.parse_stream, this);
48
- this.createXMLHttpObject = __bind(this.createXMLHttpObject, this);
49
- this._url = this.url;
50
- this._conn = this.createXMLHttpObject();
34
+ HttpConnection.__super__.constructor.apply(this, arguments);
35
+ this._url = "http://" + url;
36
+ this._conn = this._createXMLHttpObject();
51
37
  this.last_pos = 0;
52
- this.message_queue = [];
53
- this._conn.onreadystatechange = this.parse_stream;
54
- this._conn.addEventListener("load", this.connectionClosed, false);
38
+ try {
39
+ this._conn.onreadystatechange = (function(_this) {
40
+ return function() {
41
+ return _this._parse_stream();
42
+ };
43
+ })(this);
44
+ this._conn.addEventListener("load", this.on_close, false);
45
+ } catch (_error) {
46
+ e = _error;
47
+ this._conn.onprogress = (function(_this) {
48
+ return function() {
49
+ return _this._parse_stream();
50
+ };
51
+ })(this);
52
+ this._conn.onload = this.on_close;
53
+ this._conn.readyState = 3;
54
+ }
55
55
  this._conn.open("GET", this._url, true);
56
56
  this._conn.send();
57
57
  }
58
58
 
59
- HttpConnection.prototype.parse_stream = function() {
60
- var data, decoded_data;
61
- if (this._conn.readyState === 3) {
62
- data = this._conn.responseText.substring(this.last_pos);
63
- this.last_pos = this._conn.responseText.length;
64
- data = data.replace(/\]\]\[\[/g, "],[");
65
- decoded_data = JSON.parse(data);
66
- return this.dispatcher.new_message(decoded_data);
67
- }
59
+ HttpConnection.prototype.close = function() {
60
+ return this._conn.abort();
68
61
  };
69
62
 
70
- HttpConnection.prototype.trigger = function(event) {
71
- if (this.dispatcher.state !== 'connected') {
72
- return this.message_queue.push(event);
73
- } else {
74
- return this.post_data(this.dispatcher.connection_id, event.serialize());
75
- }
63
+ HttpConnection.prototype.send_event = function(event) {
64
+ HttpConnection.__super__.send_event.apply(this, arguments);
65
+ return this._post_data(event.serialize());
76
66
  };
77
67
 
78
- HttpConnection.prototype.post_data = function(connection_id, payload) {
68
+ HttpConnection.prototype._post_data = function(payload) {
79
69
  return $.ajax(this._url, {
80
70
  type: 'POST',
81
71
  data: {
82
- client_id: connection_id,
72
+ client_id: this.connection_id,
83
73
  data: payload
84
74
  },
85
75
  success: function() {}
86
76
  });
87
77
  };
88
78
 
89
- HttpConnection.prototype.flush_queue = function(connection_id) {
90
- var event, _i, _len, _ref;
91
- _ref = this.message_queue;
92
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
93
- event = _ref[_i];
94
- if (connection_id != null) {
95
- event.connection_id = this.dispatcher.connection_id;
79
+ HttpConnection.prototype._createXMLHttpObject = function() {
80
+ var e, factories, factory, xmlhttp, _i, _len;
81
+ xmlhttp = false;
82
+ factories = this._httpFactories();
83
+ for (_i = 0, _len = factories.length; _i < _len; _i++) {
84
+ factory = factories[_i];
85
+ try {
86
+ xmlhttp = factory();
87
+ } catch (_error) {
88
+ e = _error;
89
+ continue;
96
90
  }
97
- this.trigger(event);
91
+ break;
98
92
  }
99
- return this.message_queue = [];
93
+ return xmlhttp;
100
94
  };
101
95
 
102
- HttpConnection.prototype.connectionClosed = function(event) {
103
- var close_event;
104
- close_event = new WebSocketRails.Event(['connection_closed', event]);
105
- this.dispatcher.state = 'disconnected';
106
- return this.dispatcher.dispatch(close_event);
96
+ HttpConnection.prototype._parse_stream = function() {
97
+ var data, e, event_data;
98
+ if (this._conn.readyState === 3) {
99
+ data = this._conn.responseText.substring(this.last_pos);
100
+ this.last_pos = this._conn.responseText.length;
101
+ data = data.replace(/\]\]\[\[/g, "],[");
102
+ try {
103
+ event_data = JSON.parse(data);
104
+ return this.on_message(event_data);
105
+ } catch (_error) {
106
+ e = _error;
107
+ }
108
+ }
107
109
  };
108
110
 
109
111
  return HttpConnection;
110
112
 
111
- })();
113
+ })(WebSocketRails.AbstractConnection);
112
114
 
113
115
  }).call(this);