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