Implement comm_{open,msg,close} and clear_output messages

This completes implementation of IPython protocol 4.1.