You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 28, 2018. It is now read-only.
Copy file name to clipboardExpand all lines: lib/frame.js
+46-35Lines changed: 46 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,47 @@
1
-
/*
2
-
frame.js - Frame object
1
+
// ## frame
2
+
//
3
+
// The `Frame` module provides an object representation of a `Stomp` frame.
4
+
//
5
+
// ### frame.Frame
6
+
//
7
+
// An instance of the `Frame` object.
8
+
//
9
+
// var frame = new frame.Frame();
10
+
//
11
+
// ### frame.Frame.build_frame()
12
+
//
13
+
// Build a frame object from an object of arguments.
14
+
//
15
+
// var args = {
16
+
// command: '',
17
+
// headers: {},
18
+
// body: ''
19
+
// };
20
+
//
21
+
// this_frame = frame.build_frame(args);
22
+
//
3
23
4
-
Copyright (c) 2010, Benjamin W. Smith
5
-
All rights reserved.
6
24
7
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
-
9
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or
11
-
other materials provided with the distribution.
12
-
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software
13
-
without specific prior written permission.
14
-
15
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
17
-
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
20
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
-
*/
22
-
23
-
/**
24
-
* Frame - Object representation of a STOMP frame
25
-
*/
25
+
//
26
+
// ## Frame - Object representation of a STOMP frame
Copy file name to clipboardExpand all lines: lib/stomp.js
+98-66Lines changed: 98 additions & 66 deletions
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,24 @@
1
-
/*
2
-
stomp.js - STOMP Protocol in node.js
3
-
4
-
Copyright (c) 2010, Benjamin W. Smith
5
-
All rights reserved.
6
-
7
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
-
9
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or
11
-
other materials provided with the distribution.
12
-
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software
13
-
without specific prior written permission.
14
-
15
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
17
-
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
20
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
-
*/
1
+
// ## stomp
2
+
//
3
+
// The `Stomp` module provides you with a client interface for interacting with STOMP messaging brokers
4
+
//
5
+
// ### stomp.Stomp
6
+
//
7
+
// An instance of the `Stomp` object. Initialized like so:
8
+
//
9
+
// var stomp_args = {
10
+
// port: 61613,
11
+
// host: 'localhost',
12
+
// debug: false,
13
+
// login: 'guest',
14
+
// passcode: 'guest',
15
+
// };
16
+
//
17
+
// var client = new stomp.Stomp(stomp_args);
18
+
//
19
+
// If debug is set to true, extra output will be printed to the console.
20
+
21
+
// ## Helpers to handle frames, and do parsing
22
22
23
23
varnet=require('net'),
24
24
tls=require('tls'),
@@ -29,6 +29,7 @@ var net = require('net'),
29
29
utils=newstomp_utils.StompUtils(),
30
30
log=null;
31
31
32
+
32
33
functionparse_command(data){
33
34
varcommand,
34
35
this_string=data.toString('utf8',0,data.length);
@@ -231,10 +232,11 @@ function send_frame(stomp, _frame) {
231
232
returntrue;
232
233
};
233
234
234
-
/**
235
-
* Stomp - Client API
236
-
* @param {Object} args
237
-
*/
235
+
//
236
+
// ## Stomp - Client API
237
+
//
238
+
// Takes an argument object
239
+
//
238
240
functionStomp(args){
239
241
this.port=args['port']||61613;
240
242
this.host=args['host']||"127.0.0.1";
@@ -250,24 +252,27 @@ function Stomp(args) {
250
252
this['client-id']=args['client-id']||null;
251
253
};
252
254
255
+
// ## Stomp is an EventEmitter
253
256
Stomp.prototype=newprocess.EventEmitter();
254
257
255
-
/**
256
-
* Begin connection
257
-
*/
258
+
// ## Stomp.connect()
259
+
//
260
+
// **Begin connection**
261
+
//
258
262
Stomp.prototype.connect=function(){
259
263
_connect(this);
260
264
};
261
265
262
-
/**
263
-
* Handle frame based on type
264
-
* @param {Object} Frame Object
265
-
*/
266
+
// ## Stomp.handle\_new_frame()
267
+
//
268
+
// **Handle frame based on type. Emit events when needed.**
0 commit comments