### # node.js Pushserver for Tims Chat. # # @author Tim Düsterhus # @copyright 2010-2012 Tim Düsterhus # @license Creative Commons Attribution-NonCommercial-ShareAlike # @package be.bastelstu.wcf.chat ### process.title = 'Tims Chat Pushserver' io = require 'socket.io' net = require 'net' config = require('../config.js').config log = (message) -> console.log '[be.bastelstu.wcf.chat.serverPush] '+message class Server constructor: () -> log 'Starting Pushserver for Tims Chat' log 'PID is ' + process.pid log 'Using port: ' + config.port @initUnixSocket() @initSocketIO() initSocketIO: () -> @socket = io.listen config.port @socket.set 'log level', 1 @socket.set 'browser client etag', true @socket.set 'browser client minification', true @socket.set 'browser client gzig', true @socket.configure 'development', (() -> @socket.set 'log level', 3 @socket.set 'browser client etag', false @socket.set 'browser client minification', false ).bind(@) initUnixSocket: () -> log 'Initializing Unix-Socket' socket = net.createServer ((c) -> @socket.sockets.emit 'newMessage' c.end() ).bind(@) socket.listen process.cwd() + '/../data.sock' new Server()