<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Test chat</title>
    <style>
        input{
            margin: 2px;
        }
    </style>
</head>
<body>
<h3>Test chat</h3>
</body>
<script src="http://localhost:4002/socket.io/socket.io.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io-stream/0.9.1/socket.io-stream.js"></script>-->
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/push.js/1.0.8/push.min.js" integrity="sha512-eiqtDDb4GUVCSqOSOTz/s/eiU4B31GrdSb17aPAA4Lv/Cjc8o+hnDvuNkgXhSI5yHuDvYkuojMaQmrB5JB31XQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="text/javascript">

    var socket = io.connect('http://localhost:4002', {
        "transports": ["websocket"],
    });

    $(document).ready(function() {
        console.log('socket', socket)

        socket.on('updateChatList', function (msgList){
            console.log('updateChatList');
            console.log(msgList);
        })

        socket.on('setNewMessage', function (msgList){
            console.log('setNewMessage');
            console.log(msgList);
        })

        // socket.emit('getMessageList', '8','12');
        socket.on('setMessageList', function (msgList){
            console.log('setMessageList');
            console.log(msgList);
        })

        socket.on('setChatUserList', function (msgList){
            console.log('setChatUserList');
            console.log(msgList);
        })

        // step:1
        socket.emit('getChatUserList', '1');
        // step:2
        socket.emit('getMessageList', '1', '2');

        // socket.emit('getChatUserList', '2');
        // socket.emit('getMessageList', '2', '1');
        
        {{--socket.emit('sendMessage', "1698732200654098a8768e2.mp3",'2','1',"{{\Carbon\Carbon::now()}}");--}}
    });
</script>
</html>

