UNPKG

@omneedia/socketcluster

Version:

SocketCluster - A Highly parallelized WebSocket server cluster to make the most of multi-core machines/instances.

120 lines (107 loc) 3.29 kB
<!DOCTYPE html> <html> <head> <title>SocketCluster</title> <link href="//fonts.googleapis.com/css?family=Roboto:100,300" rel="stylesheet" type="text/css"> <link rel="icon" type="image/png" href="/favicon.ico"> <script type="text/javascript" src="/socketcluster.js"></script> <style> html { height: 100%; } body { margin: 0; padding: 0; width: 100%; height: 100%; color: #666666; display: table; font-weight: 100; font-family: 'Roboto', Helvetica, sans-serif; } a { font-weight: 300; color: #72B963; } .container { display: table-cell; text-align: center; vertical-align: middle; } .content { text-align: center; display: inline-block; } .title { font-size: 96px; margin-bottom: 20px; } .text { font-size: 24px; margin-bottom: 20px; } .small { font-size: 18px; } .github-button { padding-top: 10px; } </style> </head> <body> <div class="container"> <div class="content"> <div class="title"> SocketCluster </div> <div class="text"> Design is not just what it looks like and feels like. Design is how it works. &mdash; Steve Jobs </div> <div class="small"> <a href="http://socketcluster.io/#!/docs/getting-started">Getting Started</a> <strong>&middot;</strong> <a href="http://socketcluster.io/#!/docs">Documentation</a> </div> <p class="github-button"> <iframe src="https://ghbtns.com/github-btn.html?user=socketcluster&repo=socketcluster&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe> </p> </div> </div> <script type="text/javascript"> /** * NOTE: Be sure to replace the following sample logic with your own logic. */ /** const options = { // secure: true, // hostname: 'securedomain.com', // port: 443, // See https://socketcluster.io/#!/docs/api-socketcluster-client for all available options }; // Connect to SocketCluster server const socket = socketCluster.create(options); // Listen for lifecycle events emitted by SocketCluster socket.on('error', function (err) { console.error(err); }); socket.on('connect', function () { console.log('Socket is connected'); }); socket.on('subscribe', function (channelName) { console.log(`Socket is subscribed to ${channelName}`); }); // Listen for custom events socket.on('random', function (data) { console.log('Received "random" event with data: ' + data.number); }); // Subscribe to a channel const sampleChannel = socket.subscribe('sample'); sampleChannel.on('subscribeFail', function (err) { console.error('Failed to subscribe to the sample channel due to error: ' + err); }); sampleChannel.watch(function (num) { console.log('Sample channel message:', num); }); */ </script> </body> </html>