torquebox-stomp 3.0.0.beta2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/torquebox/stomp/rack/stilts-stomp-client-js.js +29 -15
- metadata +14 -14
@@ -1,6 +1,6 @@
|
|
1
|
-
// Stilts stomp-client.js 0.1.
|
1
|
+
// Stilts stomp-client.js 0.1.40
|
2
2
|
// Some parts (c) 2010 Jeff Mesnil -- http://jmesnil.net/
|
3
|
-
// 0.1.
|
3
|
+
// 0.1.40
|
4
4
|
|
5
5
|
var Stomp = {
|
6
6
|
|
@@ -34,7 +34,8 @@ var Stomp = {
|
|
34
34
|
if (headers[Stomp.Headers.CONTENT_LENGTH]) {
|
35
35
|
var len = parseInt( headers[Stomp.Headers.CONTENT_LENGTH] );
|
36
36
|
var start = divider + 2;
|
37
|
-
|
37
|
+
// content-length is bytes, substring operates on characters
|
38
|
+
body = Stomp.bytes_to_chars(Stomp.chars_to_bytes('' + data).substring(start, start+len))
|
38
39
|
} else {
|
39
40
|
// Parse body, stopping at the first \0 found.
|
40
41
|
var chr = null;
|
@@ -66,13 +67,13 @@ var Stomp = {
|
|
66
67
|
var out = command + '\n';
|
67
68
|
if (headers) {
|
68
69
|
for (header in headers) {
|
69
|
-
if (headers.hasOwnProperty(header)) {
|
70
|
+
if (header != 'content-length' && headers.hasOwnProperty(header)) {
|
70
71
|
out = out + header + ':' + headers[header] + '\n';
|
71
72
|
}
|
72
73
|
}
|
73
74
|
}
|
74
75
|
if (body) {
|
75
|
-
out = out + 'content-length:' + body.length + '\n';
|
76
|
+
out = out + 'content-length:' + Stomp.chars_to_bytes(body).length + '\n';
|
76
77
|
}
|
77
78
|
out = out + '\n';
|
78
79
|
if (body) {
|
@@ -82,9 +83,27 @@ var Stomp = {
|
|
82
83
|
}
|
83
84
|
}
|
84
85
|
},
|
86
|
+
|
87
|
+
chars_to_bytes: function(chars) {
|
88
|
+
return unescape(encodeURIComponent(chars));
|
89
|
+
},
|
90
|
+
|
91
|
+
bytes_to_chars: function(bytes) {
|
92
|
+
return decodeURIComponent(escape(bytes));
|
93
|
+
},
|
94
|
+
|
95
|
+
logger: ( function() {
|
96
|
+
if (typeof(console) == 'undefined') {
|
97
|
+
return { log: function() { }, debug: function() { } };
|
98
|
+
} else {
|
99
|
+
return console;
|
100
|
+
}
|
101
|
+
} )()
|
85
102
|
|
86
103
|
};
|
87
104
|
|
105
|
+
Stomp
|
106
|
+
|
88
107
|
|
89
108
|
Stomp.Client = function(host, port, secure) {
|
90
109
|
this._host = host || Stomp.DEFAULT_HOST;
|
@@ -174,7 +193,7 @@ Stomp.Client.prototype = {
|
|
174
193
|
},
|
175
194
|
|
176
195
|
connectionFailed: function() {
|
177
|
-
|
196
|
+
Stomp.logger.log( "unable to connect" );
|
178
197
|
},
|
179
198
|
|
180
199
|
disconnect: function(disconnectCallback) {
|
@@ -184,10 +203,6 @@ Stomp.Client.prototype = {
|
|
184
203
|
disconnectCallback();
|
185
204
|
}
|
186
205
|
},
|
187
|
-
|
188
|
-
waitForDisconnect: function() {
|
189
|
-
this._transport.waitForClosedState();
|
190
|
-
},
|
191
206
|
|
192
207
|
send: function(destination, headers, body) {
|
193
208
|
var headers = headers || {};
|
@@ -312,14 +327,13 @@ Stomp.Transport.WebSocket.prototype = {
|
|
312
327
|
|
313
328
|
_issueConnect: function() {
|
314
329
|
var headers = {};
|
315
|
-
this._ws.onerror = this.client.onerror;
|
316
330
|
if ( this._login ) {
|
317
331
|
headers['login'] = this._login;
|
318
332
|
}
|
319
333
|
if ( this._passcode ) {
|
320
334
|
headers['passcode'] = this._passcode;
|
321
335
|
}
|
322
|
-
|
336
|
+
Stomp.logger.debug( this.client );
|
323
337
|
headers[Stomp.Headers.ACCEPT_VERSION] = this.client.supportedVersions();
|
324
338
|
this.transmit( "CONNECT", headers)
|
325
339
|
},
|
@@ -822,7 +836,7 @@ Stomp.Transport.HTTP.prototype = {
|
|
822
836
|
transport.client.processMessage( message );
|
823
837
|
};
|
824
838
|
} catch (err) {
|
825
|
-
|
839
|
+
Stomp.logger.debug( err );
|
826
840
|
this._eventSource.close();
|
827
841
|
this._eventSource = undefined;
|
828
842
|
this.connectLongPoll();
|
@@ -884,14 +898,14 @@ Stomp.Transport.HTTP.prototype = {
|
|
884
898
|
var request = new XMLHttpRequest();
|
885
899
|
request.open( "POST", this._url(), true );
|
886
900
|
request.withCredentials = true;
|
887
|
-
|
901
|
+
Stomp.logger.debug( request );
|
888
902
|
if ( callbacks['load'] ) {
|
889
903
|
request.onload = function() {
|
890
904
|
callbacks['load'](request);
|
891
905
|
}
|
892
906
|
}
|
893
907
|
if ( callbacks['error'] ) {
|
894
|
-
|
908
|
+
request.onerror = function() {
|
895
909
|
callbacks['error'](request);
|
896
910
|
}
|
897
911
|
}
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torquebox-stomp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 3.0.0
|
4
|
+
prerelease:
|
5
|
+
version: 3.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- The TorqueBox Team
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: torquebox-core
|
@@ -17,13 +17,13 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0.0
|
20
|
+
version: 3.0.0
|
21
21
|
none: false
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.0.0
|
26
|
+
version: 3.0.0
|
27
27
|
none: false
|
28
28
|
prerelease: false
|
29
29
|
type: :runtime
|
@@ -33,13 +33,13 @@ dependencies:
|
|
33
33
|
requirements:
|
34
34
|
- - '='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 3.0.0
|
36
|
+
version: 3.0.0
|
37
37
|
none: false
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.0.0
|
42
|
+
version: 3.0.0
|
43
43
|
none: false
|
44
44
|
prerelease: false
|
45
45
|
type: :runtime
|
@@ -68,14 +68,14 @@ extra_rdoc_files: []
|
|
68
68
|
files:
|
69
69
|
- licenses/cc0-1.0.txt
|
70
70
|
- lib/torquebox-stomp.rb
|
71
|
-
- lib/torquebox/stomp/message.rb
|
72
71
|
- lib/torquebox/stomp/jms_stomplet.rb
|
73
|
-
- lib/torquebox/stomp/
|
74
|
-
- lib/torquebox/stomp/
|
72
|
+
- lib/torquebox/stomp/message.rb
|
73
|
+
- lib/torquebox/stomp/ext/stomplet_config.rb
|
75
74
|
- lib/torquebox/stomp/ext/http_stomp_session.rb
|
76
|
-
- lib/torquebox/stomp/ext/subscriber.rb
|
77
75
|
- lib/torquebox/stomp/ext/stomp_session.rb
|
78
|
-
- lib/torquebox/stomp/ext/
|
76
|
+
- lib/torquebox/stomp/ext/subscriber.rb
|
77
|
+
- lib/torquebox/stomp/rack/stomp_javascript_client_provider.rb
|
78
|
+
- lib/torquebox/stomp/rack/stilts-stomp-client-js.js
|
79
79
|
homepage: http://torquebox.org/
|
80
80
|
licenses:
|
81
81
|
- Public Domain
|
@@ -91,9 +91,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
91
|
none: false
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - '
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
none: false
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|