Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
whxaxes committed Aug 19, 2015
1 parent 5814832 commit dd2b2cf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ global.PATH_LINE = __dirname.match(/\/|\\/)[0];
var router = require('easy-router');

router.setMap({
"/topic/*":STATIC_PATH+"txwork/topic_*.html",
"/topic/*": STATIC_PATH + "txwork/topic_*.html",

"/public/**/*":STATIC_PATH+"**/*" //静态资源
"/public/**/*": STATIC_PATH + "**/*" //静态资源
});

require('./bigpipe/bigpipe');
Expand All @@ -26,18 +26,20 @@ require('./crossorigin/cross');

var websocket = require("./websocket/socket");

var server = router.listen(9030);
var server = http.createServer(function (req, res) {
router.route(req, res);
}).listen(9030, "127.0.0.1");

websocket.update(server , function(ws){
ws.on('close' , function(reason){
console.log("socket closed:"+reason);
websocket.update(server, function (ws) {
ws.on('close', function (reason) {
console.log("socket closed:" + reason);
});

ws.on('message' , function(data){
ws.on('message', function (data) {
websocket.brocast(data);
});
});

global.directTo404 = function(res){
global.directTo404 = function (res) {
router.error(res);
};

0 comments on commit dd2b2cf

Please sign in to comment.