lib/juggernaut/server.rb in dima-exe-juggernaut-0.5.9.1 vs lib/juggernaut/server.rb in dima-exe-juggernaut-0.5.9.22
- old
+ new
@@ -170,23 +170,24 @@
# As far as I'm aware, send_data
# never throws an exception
def publish(msg)
logger.debug "Sending msg: #{msg.to_s} to client #{@request[:client_id]} (session #{@request[:session_id]})"
- send_data(msg.to_s + CR)
- end
-
- # Connection methods
-
- def broadcast(bdy)
- msg = Juggernaut::Message.new(@current_msg_id += 1, bdy, self.signature)
if @http_request
msg = add_http_response_headers(msg)
send_data(msg)
close_connection_after_writing
else
- publish(msg)
+ send_data(msg.to_s + CR)
end
+
+ end
+
+ # Connection methods
+
+ def broadcast(bdy)
+ msg = Juggernaut::Message.new(@current_msg_id += 1, bdy, self.signature)
+ publish(msg)
end
def mark_dead(reason = "Unknown error")
# Once dead, a client never recovers since a reconnection
# attempt would hook onto a new em instance. A client