Only use spool messages for authenticated users.

This commit is contained in:
Martin Edenhofer 2013-06-23 00:33:16 +02:00
parent 0dad3bbcf3
commit c986db8b37
2 changed files with 26 additions and 22 deletions

View file

@ -33,6 +33,7 @@ class LongPollingController < ApplicationController
if params['data']['action'] == 'spool'
log 'notice', "request spool data", client_id
if current_user
spool = Session.spool_list( params['data']['timestamp'], current_user.id )
spool.each { |item|
if item[:type] == 'direct'
@ -43,6 +44,7 @@ class LongPollingController < ApplicationController
Session.send( client_id, item[:message]['data'] )
end
}
end
# send spool:sent event to client
sleep 0.2

View file

@ -139,6 +139,7 @@ EventMachine.run {
if data['action'] == 'spool'
log 'notice', "request spool data", client_id
if @clients[client_id][:session]['id']
spool = Session.spool_list( data['timestamp'], @clients[client_id][:session]['id'] )
spool.each { |item|
@ -153,6 +154,7 @@ EventMachine.run {
@clients[client_id][:websocket].send( "[#{ msg }]" )
end
}
end
# send spool:sent event to client
log 'notice', "send spool:sent event", client_id