Skip to content

Commit 415af8f

Browse files
committed
cleanups
1 parent feb314d commit 415af8f

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

README.markdown

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,18 @@ ddpclient.connect(function(error) {
5252
* Useful for debugging and learning the ddp protocol
5353
*/
5454
ddpclient.on('message', function(msg) {
55-
console.log("ddp message: " + msg);
56-
});
55+
console.log("ddp message: " + msg);
56+
});
5757

5858
/*
5959
* If you need to do something specific on close or errors.
6060
* (You can also disable auto_reconnect and call ddpclient.connect()
61-
* when you are ready to re-connect.)
61+
* when you are ready to re-connect.)
6262
*/
6363
ddpclient.on('socket-close', function(code, message) {
6464
console.log("Close: %s %s", code, message);
6565
});
66+
6667
ddpclient.on('socket-error', function(error) {
6768
console.log("Error: %j", error);
6869
});

examples/example.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var ddpclient = new DDPClient({
1010

1111
ddpclient.connect(function(error) {
1212
console.log('connected!');
13-
13+
1414
if (error) {
1515
console.log('DDP connection error!');
1616
return;
@@ -30,7 +30,7 @@ ddpclient.connect(function(error) {
3030
* Useful for debugging and learning the ddp protocol
3131
*/
3232
ddpclient.on('message', function(msg) {
33-
console.log("ddp message: " + msg);
33+
console.log("ddp message: " + msg);
3434
});
3535

3636
/*
@@ -41,6 +41,7 @@ ddpclient.on('message', function(msg) {
4141
ddpclient.on('socket-close', function(code, message) {
4242
console.log("Close: %s %s", code, message);
4343
});
44+
4445
ddpclient.on('socket-error', function(error) {
4546
console.log("Error: %j", error);
46-
});
47+
});

lib/ddp-client.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ DDPClient.prototype._prepareHandlers = function() {
4444
};
4545

4646
// if reconnecting, try existing DDP session
47-
// removed for now, per conversatino with sixolet on IRC,
47+
// removed for now, per conversation with sixolet on IRC,
4848
// reconnect on server side still needs work
4949

5050
/*
@@ -76,7 +76,7 @@ DDPClient.prototype._recoverNetworkError = function() {
7676
if (self.auto_reconnect && ! self._connectionFailed && ! self._isClosing) {
7777
setTimeout(function() { self.connect(); }, self.auto_reconnect_timer);
7878
}
79-
}
79+
};
8080

8181
///////////////////////////////////////////////////////////////////////////
8282
// RAW, low level functions
@@ -93,6 +93,7 @@ DDPClient.prototype._send = function(data) {
9393
// This callback to avoid an exception being thrown.
9494
// if an error happened, the socket will throw an event and we will recover.
9595
});
96+
9697
};
9798

9899
// handle a message from the server
@@ -112,10 +113,10 @@ DDPClient.prototype._message = function(data, flags) {
112113

113114
if (!data.msg) {
114115
return;
115-
116+
116117
} else if (data.msg === 'failed') {
117118
self.emit('failed', data);
118-
119+
119120
} else if (data.msg === 'connected') {
120121
self.session = data.session;
121122
self.emit('connected');
@@ -224,10 +225,10 @@ DDPClient.prototype.connect = function(connected) {
224225
self.addListener("connected", connected);
225226
self.addListener("failed", function(error) {
226227
self._connectionFailed = true;
227-
connected(error)
228+
connected(error);
228229
});
229230
}
230-
231+
231232
// websocket
232233
var protocol = self.use_ssl ? 'wss://' : 'ws://';
233234
self.socket = new WebSocket(protocol + self.host + ':' + self.port + '/' + self.path);

test/ddp-client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert'),
2-
sinon = require('sinon'),
2+
sinon = require('sinon'),
33
rewire = require('rewire'),
44
events = require('events');
55

@@ -26,7 +26,7 @@ describe("Connect to remote server", function() {
2626

2727
assert(wsConstructor.calledOnce);
2828
assert(wsConstructor.calledWithNew());
29-
assert(wsConstructor.call)
29+
assert(wsConstructor.call);
3030
assert.deepEqual(wsConstructor.args, [['ws://localhost:3000/websocket']]);
3131
});
3232
it('should connect to the provided host', function() {
@@ -72,7 +72,7 @@ describe('Automatic reconnection', function() {
7272
describe("Network errors", function() {
7373
beforeEach(function() {
7474
prepareMocks();
75-
})
75+
});
7676

7777
// For some weird reasons (hard to reproduce) it happens that we try to send a message and
7878
// get an exception throws at us because the connection is not opened anymore.

0 commit comments

Comments
 (0)