8784: Fix test for latest firefox.
[arvados.git] / apps / workbench / app / views / websocket / index.html.erb
1 <% content_for :page_title do %>
2   Event bus debugging page
3 <% end %>
4 <h1>Event bus debugging page</h1>
5
6 <form>
7 <textarea style="width:100%; height: 10em" id="websocket-message-content"></textarea>
8 <button type="button" id="send-to-websocket">Send</button>
9 </form>
10
11 <br>
12
13 <p id="PutStuffHere"></p>
14
15 <script>
16 $(function() {
17 putStuffThere = function (content) {
18   $("#PutStuffHere").append(content + "<br>");
19 };
20
21 var dispatcher = new WebSocket('<%= arvados_api_client.discovery[:websocketUrl] %>?api_token=<%= Thread.current[:arvados_api_token] %>');
22 dispatcher.onmessage = function(event) {
23   //putStuffThere(JSON.parse(event.data));
24   putStuffThere(event.data);
25 };
26
27 sendStuff = function () {
28   dispatcher.send($("#websocket-message-content").val());
29 };
30
31 $("#send-to-websocket").click(sendStuff);
32 });
33
34 </script>