Make sure you have enabled websockets transport before running this demo:
find
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?wireFormat.maxInactivityDuration=0"/>
</transportConnectors>
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?wireFormat.maxInactivityDuration=0"/>
<transportConnector name="websocket" uri="ws://0.0.0.0:61614"/>
</transportConnectors>