Get started with soxx CDN

ISC licensed

Soxx is a lightweight library for handling WebSockets.

Tags:
  • websocket
  • socket
  • websockets
  • sockets
  • web
  • sock
  • soxx
  • socket.io

Stable version

Copied!

How to start using soxx CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with soxx CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/soxx/2.0.3/soxx.min.js"></script>
</head>
<body>
    <button id="play">Play</button>
    <audio id="audio" src="example.mp3" preload="auto"></audio>

    <script>
        const playButton = document.getElementById('play');
        const audioElement = document.getElementById('audio');

        playButton.addEventListener('click', () => {
            const options = {
                source: audioElement.src,
                onload: () => {
                    console.log('Soxx loaded successfully');
                    soxx.play();
                },
                onend: () => {
                    console.log('Soxx finished playing');
                },
                onerror: (error) => {
                    console.error('Soxx error:', error);
                },
            };

            soxx.load(options);
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!

All versions