Blame view

src/main/resources/templates/monitor/websocket/manage.html 3.92 KB
周峰 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Hello WebSocket</title>
    <link th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/websocket.css}" rel="stylesheet">
    <script th:src="@{/webjars/jquery/3.1.1-1/jquery.min.js}"></script>
    <script th:src="@{/webjars/sockjs-client/1.0.2/sockjs.min.js}"></script>
    <script th:src="@{/webjars/stomp-websocket/2.3.3/stomp.min.js}"></script>
    <script th:src="@{/js/websocket.js}"></script>
</head>
<body>
<noscript><h2 style="color: #ff0000">Seems your browser doesn't support Javascript! Websocket relies on Javascript being
    enabled. Please enable
    Javascript and reload this page!</h2></noscript>
    <div class="col-md-6 divleft">
        <div>
            <form class="form-inline">
                <div class="form-group">
                    <button id="connect" class="btn btn-default" type="submit">连接</button>
                    <button id="disconnect" class="btn btn-default" type="submit" disabled="disabled">断开
                    </button>
                    &nbsp;&nbsp;<label for="connect">WebSocket</label> &nbsp;&nbsp;ws://127.0.0.1:8888/wms/endpoint
                </div>
            </form>
        </div>
        <hr/>
        <div>
            <div class="divtitle"><label for="name">websocket广播文本消息  &nbsp;&nbsp;&nbsp;&nbsp;</label>destination:/app/websocket/message/string</div>

            <form class="form-inline">
                <div class="form-group">

                    <input type="text" id="name" class="form-control" placeholder="msg" text="">
                    <button id="send" class="btn btn-default" type="submit">发送</button>
                </div>
            </form>
            <div class="divtitle"><label for="name">websocket广播json消息  &nbsp;&nbsp;&nbsp;&nbsp;</label>destination:/app/websocket/message/json</div>
            <form class="form-inline">
                <div class="form-group">

                    <textarea cols="60" rows='8' id="json" class="form-control" placeholder="msg">
{
周峰 authored
44
45
  "sendTo": [   "zf"  ],
  "qos": 1,
周峰 authored
46
  "data": {
周峰 authored
47
48
49
50
    "type": 1,
    "when": 1620788743297,
    "title": "这是标题",
    "content": "这是内容"
周峰 authored
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  }
}
                    </textarea>
                    <button id="send2" class="btn btn-default" type="submit">发送</button>
                </div>
            </form>
            <hr/>
            <div class="divtitle"><label for="name">httpget广播文本消息  &nbsp;&nbsp;&nbsp;&nbsp;</label>http://127.0.0.1:8888/wms/websocket/message/string?msg=abcasdf</div>

            <form class="form-inline">
                <div class="form-group">

                    <input type="text" id="msg" class="form-control" placeholder="msg" text="">
                    <button id="send3" class="btn btn-default" type="submit">发送</button>
                </div>
            </form>

            <div class="divtitle"><label for="name">httppost广播json消息  &nbsp;&nbsp;&nbsp;&nbsp;</label>http://127.0.0.1:8888/wms/websocket/message/json</div>
            <form class="form-inline">
                <div class="form-group">

                    <textarea cols="60" rows='8' id="json2" class="form-control" placeholder="msg">
{
周峰 authored
74
75
  "sendTo": [   "zf"  ],
  "qos": 1,
周峰 authored
76
  "data": {
周峰 authored
77
78
79
80
    "type": 1,
    "when": 1620788743297,
    "title": "这是标题",
    "content": "这是内容"
周峰 authored
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
  }
}
                    </textarea>
                    <button id="send4" class="btn btn-default" type="submit">发送</button>
                </div>
            </form>
        </div>

    </div>
        <div class="col-md-6">
            <table id="conversation" class="table table-striped">
                <thead>
                <tr>
                    <th>接收消息</th>
                </tr>
                </thead>
                <tbody id="greetings">
                </tbody>
            </table>
        </div>
</body>
</html>