control-freak-ide/Code/sockjs.html
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

51 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="//cdn.jsdelivr.net/sockjs/1/sockjs.min.js"></script>
<script>
var protocol = [
'websocket',
'xdr-streaming',
'xhr-streaming',
'iframe-eventsource',
'iframe-htmlfile',
'xdr-polling',
'xhr-polling',
'iframe-xhr-polling',
'jsonp-polling'
];
var options = {
debug: true,
devel: true,
noCredentials:true,
nullOrigin:true
};
options.transports = protocol;
var sock = new SockJS('http://192.168.1.37:5555/_socket',null, options);
console.error('on');
sock.onopen = function() {
console.log('open');
};
sock.onmessage = function(e) {
console.log('message', e.data);
};
sock.onclose = function() {
console.log('close');
};
sock.send('test');
sock.close();
</script>
</head>
<body>
</body>
</html>