Skip to content

Instantly share code, notes, and snippets.

@kylekyle
Created September 21, 2015 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylekyle/8751d692e2a0956ddd08 to your computer and use it in GitHub Desktop.
Save kylekyle/8751d692e2a0956ddd08 to your computer and use it in GitHub Desktop.
Blocking bidirectional communication in IRuby
comm = IRuby::Comm.new("prompter")
comm.open
session = IRuby::Kernel.instance.session
message = session.instance_eval do
unserialize(@sockets[:reply].recv_message)
end
comm.close
message[:content]['data']
__DATA__
IPython.notebook.kernel.comm_manager.register_target("prompter", function(prompter){
prompter.send("foobarcatz");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment