Tim,
Prenote: I am cross-posting to Autobahn list since (due to historic
reasons), a lot of Crossbar.io related discussion is still there ..
Am 14.08.2014 15:40, schrieb
tim.in...@gmail.com:
> Hi Tobias,
>
> I am evaluating Crossbar.io for an access control system, to be able to
> grab information from the database and serve it
> across a local network to a web browser. For example, when a user scans
> their card at the reader,
> their user-name and photo are published (pubsub) together with the door
> name and time. Elsewhere in the building, perhaps
> at the security desk, this information is displayed in a web browser.
Neat! That's an interesting application ..
> Crossbar.io looks awesome for this because
> the transport is all taken care of and we can take advantage of the
> advanced formatting capabilities in modern web browsers
> to display the information however we like and so easily. This looks
> incredibly powerful.
Oh yeah, the modern browser is probably now _the_ most capable frontend
run-time available. Plus: no vendor lock in etc.
>
> Using one of the hello demos as a starting point, the Crossbar.io
> configuration supports a web server to deliver
> the static web pages, and pubsub so the user details can be dynamically
> pushed across to the remote web browser.
Yes.
> This is all working great so far. I can display the user-name, door and
> time on the remote web page. Now I am up against my next hurdle, I need
> to pass the photo across or, rather, the pathname to the photo. The
> photos referenced by the access control system's database
> are not in the same directory as the static web pages, so I will
> translate the photo absolute pathname into a path
> relative to the web root, but how do I get the web root from
crossbar.io
> (or autobahn) within Python ?
Python application components run by Crossbar.io don't have (direct)
access to the configuration part for static Web serving. This is by design.
However, you can forward _arbitrary_ info from the config to your component.
Here is how:
"components": [
{
"type": "class",
"classname": "votes.VotesBackend",
"realm": "realm1",
"role": "anonymous",
"extra": {
"foo": "bar"
}
}
]
The "extra" can be anything you like.
You then access this "extra" stuff like this:
class VotesBackend(ApplicationSession):
def __init__(self, config):
print("Component extra config: {}".format(config.extra))
ApplicationSession.__init__(self, config)
Which means, you can forward the path to the picture directory without
hard-coding into your app component.
===
Curious: how do you upload pictures to that directory? Since Crossbar.io
has a static Web server .. but (currently) does not support
HTTP/POST/PUTting stuff up.
Technically, adding such a capability to Crossbar.io builtin Web server
would be trivial.
The other question is: we need to find a "cutoff" what's builtin. It
must be generic, and it must be applicable in broader situations.
If you have ideas, feel free to start a discussion or even file an issue
and leave your thoughts there.
Anyway, please let me know if above "extra" config stuff solves your
immediate problem at hand ..
Cheers,
/Tobias
>
> Regards,
> Tim
>
> --
> You received this message because you are subscribed to the Google
> Groups "Crossbar" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
crossbario+...@googlegroups.com
> <mailto:
crossbario+...@googlegroups.com>.
> To post to this group, send email to
cross...@googlegroups.com
> <mailto:
cross...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/crossbario/33046fa0-4871-4706-b821-75e4351e9c63%40googlegroups.com
> <
https://groups.google.com/d/msgid/crossbario/33046fa0-4871-4706-b821-75e4351e9c63%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.