Get started with openajax-hub CDN

Apache-2.0 licensed

Library: OpenAJAX Hub facilitates asynchronous AJAX data transfer.

Tags:
  • publish
  • subscribe
  • pub/sub
  • hub
  • messaging
  • broadcast
  • decoupling

Stable version

Copied!

How to start using openajax-hub CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with openajax-hub CDN - cdnhub.io</title>
  <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
  <script src="https://cdn.cdnhub.io/openajax-hub/2.0.7/OpenAjaxUnmanagedHub.min.js"></script>
  <script>
    $(document).ready(function() {
      // Initialize OpenAjaxHub
      OpenAjax.Hub.hub = new OpenAjax.Hub();

      // Define a method to be called when a message is received
      OpenAjax.Hub.hub.subscribe('/myTopic', function(message) {
        console.log('Received message:', message);
      });

      // Publish a message to the hub
      OpenAjax.Hub.hub.publish('/myTopic', { data: 'Hello, OpenAjaxHub!' });
    });
  </script>
</head>
<body>
  <!-- Your HTML content goes here -->
</body>
</html>
Copied!

All versions