lib/hara/client_interaction.rb in hara-0.3.0 vs lib/hara/client_interaction.rb in hara-0.4.0
- old
+ new
@@ -1,6 +1,9 @@
module Hara
+ class DuplicateResponseError < StandardError
+ end
+
module ClientInteraction
attr_reader :socket, :handshake, :client_ip, :client_port
def socket_setup handshake, socket
@handshake = handshake
@@ -13,10 +16,15 @@
handshake.headers_downcased
end
# send msg to client
def send_msg msg
- socket.send msg
+ message = Hara.encode_msg(type: :push, args: msg)
+ socket.send message
+ end
+
+ def response_msg msg
+ raise NotImplementedError
end
# close connection
def close code = nil, body = nil
@socket.close code, body