1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-09 00:20:08 +00:00

Optimize server.coffee

This commit is contained in:
Tim Düsterhus 2013-04-05 21:06:13 +02:00
parent 64a7578ab1
commit 74c530db80

View File

@ -1,8 +1,8 @@
###
# node.js Pushserver for Tims Chat.
#
# @author Tim Düsterhus
# @copyright 2010-2013 Tim Düsterhus
# @author Tim D<EFBFBD>sterhus
# @copyright 2010-2013 Tim D<EFBFBD>sterhus
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
# @package be.bastelstu.chat
# @subpackage nodePush
@ -35,9 +35,9 @@ class Server
process.on 'SIGINT', @shutdown.bind @
process.on 'SIGTERM', @shutdown.bind @
setInterval (() ->
setInterval =>
@socket.sockets.emit 'newMessage'
).bind(@), 60e3
, 60e3
initSocketIO: () ->
log 'Initializing socket.io'
@socket = io.listen config.port
@ -47,19 +47,18 @@ class Server
@socket.set 'browser client minification', true
@socket.set 'browser client gzip', true
@socket.configure 'development', (() ->
@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) ->
setTimeout (() ->
socket = net.createServer (c) =>
setTimeout =>
@socket.sockets.emit 'newMessage'
).bind(@), 20
, 20
c.end()
).bind(@)
socket.listen process.cwd() + '/../data.sock'
fs.chmod process.cwd() + '/../data.sock', '777'