[실습] socket.io html 클라이언트 소스
필기자
2024-04-09 10:18
2,368
0
본문
socket_client.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Axios Example</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://cdn.socket.io/socket.io-3.0.1.min.js"></script>
<script>
var socket;
//소켓아이오 js
////////////////////////////////////////////////////////////////////////////
socket = io.connect('http://서버아이피:서버포트', {
upgrade: false,
transports: ['websocket']
})
/*
socket = io({
transports : [ 'websocket' ]
});
*/
socket.on('connect', function() {
console.log('소켓 접속 완료');
//alertShow('socket connection complete');
});
socket.on('disconnect', function() {
console.log('소켓 접속 종료');
});
socket.on('ai_parking_indoor_detecting_info', function(data) {
console.log("info", data);
});
socket.on('ai_parking_detecting_log', function(data) {
console.log("log", data);
});
$(function(){
alert("클라이언트 실행");
});
</script>
</body>
</html>
댓글목록0