Permalink
Browse files

new fake channel for error and system output and fix bug associate ch…

…annel
  • Loading branch information...
1 parent d2ba0e8 commit 107650439ec2eac223fd5e402614cafd8b09fa7c @iRyusa iRyusa committed Nov 15, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/hornet_server.js
View
@@ -33,6 +33,7 @@ var handleConnection = function( rawMessage ) {
var msg = {
type: "error",
+ channel: "hornet",
error: "WRONG_PARAMETERS",
errorMsg: "Client connection error: Wrong parameters. You should connect to hornet specifying channel and hornetToken parameters"
};
@@ -52,6 +53,7 @@ var handleConnection = function( rawMessage ) {
if (exists != 1) {
var msg = {
type: "error",
+ channel: "hornet",
error: "INVALID_TOKEN",
errorMsg : "Invalid token used, please get a new token"
};
@@ -99,11 +101,12 @@ var handleConnection = function( rawMessage ) {
var msg = {
type: "error",
+ channel: "hornet",
error: "WRONG_TOKEN_ASSOCIATION",
errorMsg : "Connection error : unauthorized access"
};
- socket.send( msg );
+ socket.send( JSON.stringify(msg) );
// TODO : maybe we should consider logging more data about the client here...
utils.log('Client connection error: token:' + token + ' not associated to channel:' + wrongChannel );

0 comments on commit 1076504

Please sign in to comment.