renamed execute_websocket_command to open_websocket_connection, because we now run the command after all listeners in the submissions controller were attached

This commit is contained in:
Ralf Teusner
2016-03-01 11:25:49 +01:00
parent 94c31e35a4
commit b31a5b37f4
2 changed files with 10 additions and 6 deletions

View File

@ -111,6 +111,7 @@ class SubmissionsController < ApplicationController
if result[:status] == :container_running
socket = result[:socket]
command = result[:command]
socket.on :message do |event|
Rails.logger.info( Time.now.getutc.to_s + ": Docker sending: " + event.data)
@ -139,6 +140,11 @@ class SubmissionsController < ApplicationController
Rails.logger.debug('Rescued parsing error, sent the received client data to docker:' + data)
end
end
# Send command after all listeners are attached.
# Newline required to flush
socket.send command + "\n"
Rails.logger.info('Sent command: ' + command.to_s)
else
kill_socket(tubesock)
end