Class: WiserChatController

Inherits:
WebsocketRails::BaseController
  • Object
show all
Includes:
ActionView::Helpers::SanitizeHelper
Defined in:
app/controllers/wiser_chat_controller.rb

Instance Method Summary collapse

Instance Method Details

#client_connectedObject


9
10
11
# File 'app/controllers/wiser_chat_controller.rb', line 9

def client_connected
  puts "Action: Client Connected"
end

#delete_userObject


27
28
29
30
31
32
33
# File 'app/controllers/wiser_chat_controller.rb', line 27

def delete_user
  puts "Action: Delete User"
  @channel_name, @user = get_channel_and_user(connection_store[:user])
  send_system_message(@channel_name, "#{@user.name} disconnected!")
  remove_channel_user
  send_user_list(@channel_name)
end

#initialize_sessionObject


4
5
6
7
# File 'app/controllers/wiser_chat_controller.rb', line 4

def initialize_session
  puts ""
  puts "Session Initialized"
end

#new_messageObject


13
14
15
16
17
# File 'app/controllers/wiser_chat_controller.rb', line 13

def new_message
  puts "Action: New Message"
  @channel_name, @user = get_channel_and_user(message)
  send_user_message(@channel_name, @user, message[:msg_body])
end

#new_userObject


19
20
21
22
23
24
25
# File 'app/controllers/wiser_chat_controller.rb', line 19

def new_user
  puts "Action: New User"
  @channel_name, @user = get_channel_and_user(message)
  send_system_message(@channel_name, "#{@user.name} is now connected!")
  add_channel_user(@channel_name, @user)
  send_user_list(@channel_name)
end