Code Monkey home page Code Monkey logo

crossbardemo's Introduction

Crossbar.io Demos

Crossbar.io comes with ready-to-run demos that show off different features of Crossbar.io.

The complete demo bundle is available as a Python package which you can install into your existing Crossbar.io installation and try yourself - see below.

For installation of Crossbar.io itself, please see the Getting Started.

The source-code for the demos can be found in the repository here and is open-source licensed under the Apache 2.0 license. This allows you to reuse the code even in commercial projects for use as starting points in your development.

Try it

Install the demos package

To install from PyPI

pip install crossbardemo

To upgrade an existing package from PyPI

pip install --upgrade crossbardemo

Create a new Crossbar.io node

mkdir -p $HOME/demo1/.crossbar

Add a node configuration file $HOME/demo1/.crossbar/config.json:

{
   "controller": {
   },
   "workers": [
      {
         "type": "router",
         "realms": [
            {
               "name": "crossbardemo",
               "roles": [
                  {
                     "name": "anonymous",
                     "permissions": [
                        {
                           "uri": "io.crossbar.demo.*",
                           "publish": true,
                           "subscribe": true,
                           "call": true,
                           "register": true
                        }
                     ]
                  }
               ]
            }
         ],
         "transports": [
            {
               "type": "web",
               "endpoint": {
                  "type": "tcp",
                  "port": 8080
               },
               "paths": {
                  "/": {
                     "type": "static",
                     "package": "crossbardemo",
                     "resource": "web"
                  },
                  "ws": {
                     "type": "websocket"
                  }
               }
            }
         ],
         "components": [
            {
               "type": "class",
               "classname": "crossbardemo.votes.VotesBackend",
               "realm": "crossbardemo",
               "role": "anonymous"
            }
         ]
      }
   ]
}

and start the node

cd $HOME/demo1
crossbar start

Crossbar.io will log startup

(python279_1)oberstet@thinkpad-t430s:~/nodes/node4$ crossbar start
2015-02-19 11:20:00+0100 [Controller   5204] Log opened.
2015-02-19 11:20:00+0100 [Controller   5204] ==================== Crossbar.io ====================
    
2015-02-19 11:20:00+0100 [Controller   5204] Crossbar.io 0.10.2 starting
2015-02-19 11:20:00+0100 [Controller   5204] Running on CPython using EPollReactor reactor
2015-02-19 11:20:00+0100 [Controller   5204] Starting from node directory /home/oberstet/nodes/node4/.crossbar
2015-02-19 11:20:00+0100 [Controller   5204] Starting from local configuration '/home/oberstet/nodes/node4/.crossbar/config.json'
2015-02-19 11:20:00+0100 [Controller   5204] Warning, could not set process title (setproctitle not installed)
2015-02-19 11:20:00+0100 [Controller   5204] No WAMPlets detected in enviroment.
2015-02-19 11:20:00+0100 [Controller   5204] Starting Router with ID 'worker1' ..
2015-02-19 11:20:00+0100 [Controller   5204] Entering reactor event loop ...
2015-02-19 11:20:00+0100 [Router       5213] Log opened.
2015-02-19 11:20:00+0100 [Router       5213] Warning: could not set worker process title (setproctitle not installed)
2015-02-19 11:20:01+0100 [Router       5213] Running under CPython using EPollReactor reactor
2015-02-19 11:20:01+0100 [Router       5213] Entering event loop ..
2015-02-19 11:20:01+0100 [Controller   5204] Router with ID 'worker1' and PID 5213 started
2015-02-19 11:20:01+0100 [Controller   5204] Router 'worker1': realm 'realm1' started
2015-02-19 11:20:01+0100 [Controller   5204] Router 'worker1': role 'role1' started on realm 'realm1'
2015-02-19 11:20:01+0100 [Router       5213] VotesBackend: 3 procedures registered!
2015-02-19 11:20:01+0100 [Controller   5204] Router 'worker1': component 'component1' started
2015-02-19 11:20:01+0100 [Router       5213] Loaded static Web resource 'web' from package 'crossbardemo 0.3.7' (filesystem path /home/oberstet/python279_1/lib/python2.7/site-packages/crossbardemo-0.3.7-py2.7.egg/crossbardemo/web)
2015-02-19 11:20:01+0100 [Router       5213] Site starting on 8080
2015-02-19 11:20:01+0100 [Controller   5204] Router 'worker1': transport 'transport1' started
...

Test the Demos

Open the demos entry page at http://127.0.0.1:8080 in your browser

Then, for example, open the "Chat" demos in two browser tabs to see it communicate in real-time

crossbardemo's People

Contributors

markope avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.