trabajo-afectivo/lib/sessions/event/chat_session_typing.rb

32 lines
665 B
Ruby
Raw Normal View History

class Sessions::Event::ChatSessionTyping < Sessions::Event::ChatBase
2015-11-10 14:01:04 +00:00
def run
return if !check_chat_session_exists
chat_session = current_chat_session
2015-11-10 14:01:04 +00:00
user_id = nil
if @session
user_id = @session['id']
2015-11-10 14:01:04 +00:00
end
message = {
event: 'chat_session_typing',
data: {
session_id: chat_session.session_id,
user_id: user_id,
},
}
# send to participents
chat_session.send_to_recipients(message, @client_id)
2015-11-10 14:01:04 +00:00
# send chat_session_init to agent
{
event: 'chat_session_typing',
data: {
session_id: chat_session.session_id,
self_written: true,
},
}
end
end