Web Component for Autobahn (in Polymer?)

#1

I don’t have much experience with either so I don’t know if this already exists or would be interesting.

Anyway, like the title says, is there a Web Component for WAMP? And wouldn’t it be great to have one, similar to the core-ajax element in Polymer?

If it doesn’t exist and someone is interested in implementing it, I’d love to help.

0 Likes

#2

Hi,

I built a polymer webcomponent for autobahn but it works a little different than the core-ajax component.

When I use autobahn with a router (crossbar in my case) then I don’t use it as a one-shot-request like ajax but rather I establish a “session”

which I keep using for the whole life cycle of the component. I guess that’s what you are looking for.

In fact in my application I use one global session for all the messaging needs of my application, so this approach does not strictly follow the web component idea here.

In my opinion establishing a session with the same backend for every single component in an app would be too much overhead.

Take a look at the attached code. In that component I used some demo code supplied by Tobias Oberstein as part of his usage examples.

autobahn-connection.html (0 Bytes)

···

Am Montag, 9. Februar 2015 03:38:36 UTC+1 schrieb LDGN:

I don’t have much experience with either so I don’t know if this already exists or would be interesting.

Anyway, like the title says, is there a Web Component for WAMP? And wouldn’t it be great to have one, similar to the core-ajax element in Polymer?

If it doesn’t exist and someone is interested in implementing it, I’d love to help.

0 Likes

#3

The code looks very interesting. One question, though: Why don’t you pass the session to the other polymer components as a parameter to the autobahnready call? That way, you could avoid a global variable.

Regards,

···

On Monday, February 9, 2015 at 2:23:16 PM UTC+1, Marko Petzold wrote:

Hi,

I built a polymer webcomponent for autobahn but it works a little different than the core-ajax component.

When I use autobahn with a router (crossbar in my case) then I don’t use it as a one-shot-request like ajax but rather I establish a “session”

which I keep using for the whole life cycle of the component. I guess that’s what you are looking for.

In fact in my application I use one global session for all the messaging needs of my application, so this approach does not strictly follow the web component idea here.

In my opinion establishing a session with the same backend for every single component in an app would be too much overhead.

Take a look at the attached code. In that component I used some demo code supplied by Tobias Oberstein as part of his usage examples.

0 Likes

#4

true. I guess I’ll do that. I am still not quite happy with the required core-signal on every autobahn element though.
Maybe it would be better to have an autobahn-mixin, which encapsulates the core-signal registration procedure.

···

Am Donnerstag, 12. Februar 2015 20:17:59 UTC+1 schrieb Aaron Digulla:

On Monday, February 9, 2015 at 2:23:16 PM UTC+1, Marko Petzold wrote:

Hi,

I built a polymer webcomponent for autobahn but it works a little different than the core-ajax component.

When I use autobahn with a router (crossbar in my case) then I don’t use it as a one-shot-request like ajax but rather I establish a “session”

which I keep using for the whole life cycle of the component. I guess that’s what you are looking for.

In fact in my application I use one global session for all the messaging needs of my application, so this approach does not strictly follow the web component idea here.

In my opinion establishing a session with the same backend for every single component in an app would be too much overhead.

Take a look at the attached code. In that component I used some demo code supplied by Tobias Oberstein as part of his usage examples.

The code looks very interesting. One question, though: Why don’t you pass the session to the other polymer components as a parameter to the autobahnready call? That way, you could avoid a global variable.

Regards,

0 Likes