manage.html 3.92 KB
<!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">
{
  "sendTo": [   "zf"  ],
  "qos": 1,
  "data": {
    "type": 1,
    "when": 1620788743297,
    "title": "这是标题",
    "content": "这是内容"
  }
}
                    </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">
{
  "sendTo": [   "zf"  ],
  "qos": 1,
  "data": {
    "type": 1,
    "when": 1620788743297,
    "title": "这是标题",
    "content": "这是内容"
  }
}
                    </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>