lib/web-repl/messenger.rb
# Send a message over the socket
# @param [Hash] message A message to send
# @return [String, nil] If a message was sent, its JSON string; otherwise nil
Send a message over the socket
Send a message over the socket
def out(message)
      if !@socket.nil?
        message[:timestamp] ||= new_timestamp
        json = message.to_json
        @debug.puts "Sending message: #{json}" if @debug
        @socket.send(json)
        json
      else
        @debug.puts "Warning: No connection" if @debug
        nil
      end
    end
def out ( message ) if ! @socket . nil? message [ :timestamp ] ||= new_timestamp json = message . to_json @debug . puts "Sending message: #{json}" if @debug @socket . send ( json ) json else @debug . puts "Warning: No connection" if @debug nil end end
Send a message over the socket
Send a message over the socket
If a message was sent, its JSON string; otherwise nil
If a message was sent its JSON string ; otherwise nil
String, nil
message
message A message to send
message A message to send