Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Enable Node 5 compatibility #10

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/echo-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class EchoServer {
this.loadSSL().then(() => {
resolve(this.secureSocketIoServer());
}, error => this.log(error, 'error'));
} else {
} else {
resolve(this._io = io(this.options.port));
}
});
Expand Down Expand Up @@ -358,8 +358,13 @@ export class EchoServer {
channel: string,
members: string[],
member: string,
action: string = null
action: string
): void {

if (action === undefined) {
action = null;
}

let currentSocket = this._io.sockets.connected[socket.id];

if (action == 'add') {
Expand All @@ -380,8 +385,13 @@ export class EchoServer {
presenceChannelEvents(
channel: string,
socket: any,
member: string = null
member: string
): void {

if (member === undefined) {
member = null;
}

this.addToPressence(socket, channel, member);
socket.on('disconnect', () => this.removeFromPresence(socket, channel));
}
Expand Down Expand Up @@ -479,7 +489,12 @@ export class EchoServer {
* @param {string} status
* @return {void}
*/
protected log(message: any, status: string = 'success'): void {
protected log(message: any, status: string): void {

if (status === undefined) {
status = 'success';
}

if (status == 'success') {
console.log("\x1b[32m%s\x1b[0m:", 'EchoServer', JSON.stringify(message));
} else {
Expand Down