Change websocket handlers to return results.

This is the first step to fixing #66.