Improved logging.

This commit is contained in:
Martin Edenhofer 2015-05-10 09:21:42 +02:00
parent bb2bce6763
commit 17d499cbe3

View file

@ -34,7 +34,7 @@ class App.WebSocket
class _webSocketSingleton extends App.Controller class _webSocketSingleton extends App.Controller
@include App.LogInclude @include App.LogInclude
queue: [] queue: []
supported: true supported: true
lastSpoolMessage: undefined lastSpoolMessage: undefined
sentSpoolFinished: true sentSpoolFinished: true
@ -43,6 +43,7 @@ class _webSocketSingleton extends App.Controller
connectionWasEstablished: false connectionWasEstablished: false
tryToConnect: false tryToConnect: false
backend: 'websocket' backend: 'websocket'
backend_port: ''
client_id: undefined client_id: undefined
error: false error: false
@ -185,14 +186,16 @@ class _webSocketSingleton extends App.Controller
if @backend is 'websocket' if @backend is 'websocket'
@ws = new window.WebSocket( protocol + window.location.hostname + '/ws' ) @ws = new window.WebSocket( protocol + window.location.hostname + '/ws' )
else if @backend is 'websocketPort' else if @backend is 'websocketPort'
websocket_port = App.Config.get('websocket_port') || '6042' @backend_port = App.Config.get('websocket_port') || '6042'
@ws = new window.WebSocket( protocol + window.location.hostname + ':' + websocket_port + '/' ) @ws = new window.WebSocket( protocol + window.location.hostname + ':' + @backend_port + '/' )
else else
@_ajaxInit() @_ajaxInit()
# Set event handlers. # Set event handlers.
@ws.onopen = => @ws.onopen = =>
@log 'notice', "new websocket (#{@channel()}) connection open" if @backend_port
port = ":#{@backend_port}"
@log 'notice', "new websocket (#{@channel()}#{port}) connection open"
@connectionEstablished = true @connectionEstablished = true
@connectionWasEstablished = true @connectionWasEstablished = true
@ -201,7 +204,7 @@ class _webSocketSingleton extends App.Controller
App.Delay.clear('websocket-no-connection-try-reconnect-message', 'ws') App.Delay.clear('websocket-no-connection-try-reconnect-message', 'ws')
if @error if @error
@error.hide() @error.hide()
@error = false @error = false
@tryToConnect = false @tryToConnect = false
@auth() @auth()