Get started with jschannel CDN
(MPL-1.1 OR GPL-2.0 OR LGPL-2.1) licensed
JSchannel is a library for establishing secure shell connections in Java.
Tags:- postMessage
- cross-domain
- iframe
- mozilla
- messaging
Stable version
Copied!
How to start using jschannel CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with jschannel CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/jschannel/1.0.0-git-commit1-8c4f7eb/jschannel.min.js"></script>
</head>
<body>
<button id="send">Send Message</button>
<div id="messages"></div>
<script>
const messages = document.getElementById('messages');
const sendButton = document.getElementById('send');
const channel = new Jschannel.Channel('my_channel', {
server: 'http://localhost:8080/ws', // Replace with your WebSocket server URL
client: {
onOpen: () => console.log('Channel opened'),
onMessage: message => messages.innerHTML += `<p>Received: ${message.data}</p>`,
onClose: () => console.log('Channel closed')
}
});
sendButton.addEventListener('click', () => {
channel.send('Hello from the client!');
});
</script>
</body>
</html>
Copied!
Copied!