crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 275 forks source link

Expand the WSGI/Flask/Django integration docs/examples #1017

Open glenfant opened 7 years ago

glenfant commented 7 years ago

Hi,

When trying some templates with "crossbar init --template hello:nodejs" or "crossbar init --template hello:python", the "index.html" provided files refers an Amazon CDN provided Autobahn.js"

...
<script src="http://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.min.jgz"></script>
...

But this CDN has been removed by your fellows from Autobahn team. Thus these templates - and perhaps others - don't work.

https://groups.google.com/forum/#!topic/autobahnws/aHxWgImJvCY

Cheers

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/43690017-expand-the-wsgi-flask-django-integration-docs-examples?utm_campaign=plugin&utm_content=tracker%2F462544&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F462544&utm_medium=issues&utm_source=github).
oberstet commented 7 years ago

@glenfant Hi Gilles, nice to hear from you again;) We met at EuroPy last year in Bilbao .. talking about Plone etc

Rgd the templates:

  1. latest Crossbar.io release (17.3.1) now includes AutobahnJS, and the default template uses this
  2. for the time being, we have removed all templates other than the default one, because we've been unable to keep up maintaining all these, as we don't have the resources currently

Rgd 2: thinking is, if we can't keep up, then better not distribute at all rather distribute sth outdated.

You can find all the "hello" examples that were previously created from templates here and in the folders below.

This repo contains many many examples.

Which templates / languages are you interested in?

glenfant commented 7 years ago

Hi @oberstet ,

Real fans work on sunday ;) This is a great news for Crossbar / Autobahn fans who got a very fast and efficient support. Many thanks for this fast feedback and hear from you.

Thanks, a "pip install -U crossbar" fixed the scaffolds (non) issue. I should read the changelog before issuing a ticket.

I can understand that maintainig templates IN crossbar may be painful. May I suggest the use of a good scaffolding tool (yeoman, cookiecutter, ...) in the future as a crossbar starter ?

The examples are great, many thanks to the contributors. I'm focusing on Python and JS examples.

BTW, is the crossbar WSGI server production ready (for a Django app) or should I prefer a more classical solution as Gunicorn or uWSGI ?

Don't reply now, enjoy your sunday with your friends and family ;)

meejah commented 7 years ago

@glenfant The Crossbar WSGI server is "just" Twisted's, so the answer is "yes it's production ready". See https://twistedmatrix.com/trac/wiki/TwistedWeb

oberstet commented 7 years ago

Yeah, it is good to use.

The docs are lagging behind though. We actually have two more options that allow to control the underlying thread pool created:


The docs probably should also have some more examples or link to them.

There is: https://github.com/crossbario/crossbar-examples/tree/master/django/realtimemonitor

This was contributed by https://github.com/sametmax, who has deeper Django know-how and also used Crossbar.io in this way a lot. So actually, @sametmax will know best. At least I know next to nothing about Django.


Then there are these: https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/app/crochet

These show how to integrate WAMP client code talking to Crossbar.io (or in general a WAMP router), from within a blocking Flask/WSGI server running outside of Crossbar.io.

I wrote those as I was still into Flask .. but they should be good still.

oberstet commented 7 years ago

More related content:

glenfant commented 7 years ago

Thanks @oberstet and @meejah for the time you spent to help me (and perhaps others). I just need to spend some time to "twist" my "asyncio" brain 👍