Get started with ratchet CDN

MIT licensed

The Ratchet library is a micro-framework for building web applications with a focus on simplicity and ease of use, using the Sinatra DSL for routing and handling HTTP requests.

Tags:
  • mobile
  • components

Stable version

Copied!

How to start using ratchet CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with ratchet CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/ratchet/2.0.2/js/ratchet.min.js"></script>
  <style>
    #message {
      width: 300px;
      height: 100px;
      border: 1px solid #ccc;
      padding: 10px;
    }
  </style>
</head>
<body>
  <div id="message"></div>
  <script>
    const io = new Ratchet.Connection('wss://your-server.com/ws');

    io.on('connect', () => {
      console.log('Connected to server');
      io.send('Hello from client');
    });

    io.on('message', (data) => {
      document.getElementById('message').innerText = data;
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions