# File lib/ftw/websocket/writer.rb, line 45 def write_text(connection, text, mode=:server) if !VALID_MODES.include?(mode) raise InvalidArgument.new("Invalid message mode: #{mode}, expected one of" \ "#{VALID_MODES.inspect}") end data = [] pack = [] # For now, assume single-fragment, text frames pack_opcode(data, pack, OPCODE_TEXT) pack_payload(data, pack, text, mode) connection.write(data.pack(pack.join(""))) end