class SocketClientWebSockets
Public Instance Methods
close_connection_after_writing()
click to toggle source
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 100 def close_connection_after_writing @websocket.close_connection_after_writing end
post_init()
click to toggle source
default constructor
Calls superclass method
SocketClientBase#post_init
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 70 def post_init super end
send_raw_data(response)
click to toggle source
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 93 def send_raw_data(response) try_send_binary(response) nil end
send_response(response_obj)
click to toggle source
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 80 def send_response(response_obj) return unless @is_online report_about_sent_request(response_obj) response = AMF::Root.serialize(response_obj) try_send_binary(response) nil #for prevent return other value end
websocket=(value)
click to toggle source
properties
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 24 def websocket=(value) @websocket = value init_ip_internal(@websocket.get_peername) @websocket.onopen do |handshake| begin on_connection_open(handshake) rescue Exception => e on_error(e) end end @websocket.onclose do begin on_connection_closed rescue Exception => e on_error(e) end end @websocket.onmessage do |data| begin receive_data(data) rescue Exception => e on_error(e) end end @websocket.onbinary do |data| begin receive_data(data) rescue Exception => e on_error(e) end end nil end
Protected Instance Methods
init_ip()
click to toggle source
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 75 def init_ip #do nothing end
on_connection_open(handshake)
click to toggle source
Access properties on the EM::WebSocket::Handshake object, e.g. path, query_string, origin, headers
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 11 def on_connection_open(handshake) end
on_error(e)
click to toggle source
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 15 def on_error(e) AppInfo.instance.on_server_error(e.to_s, e) end
Private Instance Methods
try_send_binary(response)
click to toggle source
# File lib/mrpin/core/remote/socket/websocket/socket_client_web_sockets.rb, line 105 def try_send_binary(response) return unless @is_online begin @websocket.send_binary(response) rescue #do nothing end nil end