Skip to content

Commit

Permalink
move faye-redis config out for config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Mar 11, 2013
1 parent 1401b17 commit 6d39993
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
10 changes: 1 addition & 9 deletions config.js
Expand Up @@ -93,14 +93,6 @@ configData.faye = {
mount: "/faye",
timeout: 45,
ping: null,
engine: {
type: require('faye-redis'),
host: configData.redis.host,
port: configData.redis.port,
password: configData.redis.password,
database: configData.redis.DB,
namespace: "faye:",
}
};

///////////////////////////////////////
Expand Down Expand Up @@ -175,7 +167,7 @@ configData.tcpServer = {

configData.webSockets = {
// You must have the web server enabled as well
enable: false,
enable: true,
};

//////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions examples/clients/web/webSockets.html
@@ -1,6 +1,9 @@
<script src="/faye/client.js"></script>
<script src="/public/javascript/actionHeroWebSocket.js"></script>

<h1>Websocket Example</h1>
Open the Console.

<script>

var A = new actionHeroWebSocket;
Expand Down
15 changes: 14 additions & 1 deletion initializers/faye.js
Expand Up @@ -9,7 +9,20 @@ var faye = function(api, next){
// api.faye.subscribeHandlers = [];

api.faye._start = function(api, next){
api.faye.server = new fayePackage.NodeAdapter(api.configData.faye);

var options = api.configData.faye;
if(api.redis.fake != true){
options.engine = {
type: require('faye-redis'),
host: api.configData.redis.host,
port: api.configData.redis.port,
password: api.configData.redis.password,
database: api.configData.redis.DB,
namespace: "faye:",
}
}

api.faye.server = new fayePackage.NodeAdapter(options);

api.faye.server.bind('handshake', function(clientId){
for(var i in api.faye.connectHandlers){
Expand Down

0 comments on commit 6d39993

Please sign in to comment.