@@ -15,7 +15,7 @@ module.exports = {
15
15
//
16
16
// HTTP Error function
17
17
//
18
- doHttpError : function ( errID , errMsg , res ) {
18
+ throwHttpError : function ( errID , errMsg , res ) {
19
19
res . writeHead ( errID , {
20
20
"Content-Type" : "text/plain"
21
21
} ) ;
@@ -57,7 +57,7 @@ module.exports = {
57
57
res . statusCode = 200 ;
58
58
return true ;
59
59
} else {
60
- module . exports . doHttpError ( 403 , 'Forbidden' , res ) ;
60
+ module . exports . throwHttpError ( 403 , 'Forbidden' , res ) ;
61
61
return false ;
62
62
}
63
63
// not enabled
@@ -69,7 +69,7 @@ module.exports = {
69
69
//
70
70
// Get Notify User Info from GET call
71
71
//
72
- doGetNotifyInfo : function ( req , res ) {
72
+ getNotifyInfo : function ( req , res ) {
73
73
// parse URL
74
74
var parsedUrl = url . parse ( req . url , true ) ;
75
75
// get JSON
@@ -92,11 +92,11 @@ module.exports = {
92
92
// check enabled sockets
93
93
if ( lRoom === 'private' ) {
94
94
if ( ! ( isPrivate ) ) {
95
- module . exports . doHttpError ( 404 , 'Room private is not enabled' , res ) ;
95
+ module . exports . throwHttpError ( 404 , 'Room private is not enabled' , res ) ;
96
96
}
97
97
} else if ( lRoom === 'public' ) {
98
98
if ( ! ( isPublic ) ) {
99
- module . exports . doHttpError ( 404 , 'Room public is not enabled' , res ) ;
99
+ module . exports . throwHttpError ( 404 , 'Room public is not enabled' , res ) ;
100
100
}
101
101
}
102
102
// check parameter
@@ -115,23 +115,23 @@ module.exports = {
115
115
optparam : lOptParam
116
116
} ;
117
117
} else {
118
- module . exports . doHttpError ( 404 , 'Check valid values: type' , res ) ;
118
+ module . exports . throwHttpError ( 404 , 'Check valid values: type' , res ) ;
119
119
}
120
120
} else {
121
- module . exports . doHttpError ( 404 , 'Check valid values: room' , res ) ;
121
+ module . exports . throwHttpError ( 404 , 'Check valid values: room' , res ) ;
122
122
}
123
123
} else {
124
- module . exports . doHttpError ( 404 , 'Check Parameter' , res ) ;
124
+ module . exports . throwHttpError ( 404 , 'Check Parameter' , res ) ;
125
125
}
126
126
} ,
127
127
//
128
128
// Server index.html file (Overview)
129
129
//
130
- doServeIndex : function ( res ) {
130
+ serveIndex : function ( res ) {
131
131
fs . readFile ( './index.html' , function ( err , html ) {
132
132
// HTTP 404 when error
133
133
if ( err ) {
134
- module . exports . doHttpError ( 404 , 'Not Found' , res ) ;
134
+ module . exports . throwHttpError ( 404 , 'Not Found' , res ) ;
135
135
// write index.html
136
136
} else {
137
137
res . write ( html ) ;
@@ -142,11 +142,11 @@ module.exports = {
142
142
//
143
143
// Server client.html file (testclient)
144
144
//
145
- doServeClient : function ( res ) {
145
+ serveClient : function ( res ) {
146
146
fs . readFile ( './client.html' , function ( err , html ) {
147
147
// HTTP 404 when error
148
148
if ( err ) {
149
- module . exports . doHttpError ( 404 , 'Not Found' , res ) ;
149
+ module . exports . throwHttpError ( 404 , 'Not Found' , res ) ;
150
150
// write index.html
151
151
} else {
152
152
res . write ( html ) ;
@@ -157,7 +157,7 @@ module.exports = {
157
157
//
158
158
// Delete user session older than 3 hours
159
159
//
160
- doDeleteOldSessions : function ( ) {
160
+ deleteOldSessions : function ( ) {
161
161
setInterval ( function ( ) {
162
162
localstore . deleteOldSessions ( function ( dbres , err ) {
163
163
if ( dbres ) {
0 commit comments