base: support for sending binary frames over a websocket.

Fixes #629.
(cherry picked from commit 087dba4979c667d944c1198a60d3f26597990220)