Is there possibility to subscribe before connect?

#1

Hello,

I use the JS implementation like this:

``

conn.subscribe('kittensCategory', function(topic, data) {

Is there any possibility to do this:

without error “Autobahn not connected”?

I would suggest to change the function ab.Session.prototype.subscribe in this way (pseudo code):
if (! is_connected) {
self.before_connect_subscribe_data.push(subscribe_data);
} else {
// normal subscribe
}

And then change the function ab.Session in this way (pseudo code):
before calling
self._websocket_onopen();
do
foreach (self.before_connect_subscribe_data as data) {
do_subscribe(data);
}

Is my suggestion clear?

Thanks,
Michal

0 Likes

#2

Hi,

And then change the function ab.Session in this way (pseudo code):
before calling
self._websocket_onopen();
do
foreach (self.before_connect_subscribe_data as data) {
    do_subscribe(data);
}

Is my suggestion clear?

Yes, but:

1) AutobahnJS/WAMP1 (the version that is mentioned above) is no longer maintained. No changes will be applied to that code base anymore.
2) What's the point adding complexity when you just can subscribe when connected?

Cheers,
/Tobias

···

Thanks,
Michal

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
To post to this group, send email to autob...@googlegroups.com
<mailto:autob...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

Is there any other JS version suitable for usage with PHP server (like Ratchet)?

I would like to provide the session as service in window object. Now I have to specify all subscriptions (which I want to do immediately) in the onconnect callback. After implementation of my suggestion I could use
conn.subscribe('kittensCategory', ...anywhere and it would send the subscription in first possible moment.Or is there a workaroud with which I could use conn.subscribe anywhere on different places? (For example use conn.onload(function(){}) multiple times and even after success connection?)

Dne středa, 29. října 2014 18:43:32 UTC+1 Tobias Oberstein napsal(a):

···

Hi,

And then change the function ab.Session in this way (pseudo code):

before calling

self._websocket_onopen();

do

foreach (self.before_connect_subscribe_data as data) {

do_subscribe(data);

}

Is my suggestion clear?

Yes, but:

  1. AutobahnJS/WAMP1 (the version that is mentioned above) is no longer
    maintained. No changes will be applied to that code base anymore.

  2. What’s the point adding complexity when you just can subscribe when
    connected?

Cheers,

/Tobias

Thanks,

Michal

You received this message because you are subscribed to the Google

Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send

an email to autobahnws+...@googlegroups.com

mailto:autobahnws+unsub...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com

mailto:autob...@googlegroups.com.

To view this discussion on the web visit

https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com

<https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com?utm_medium=email&utm_source=footer>.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#4

Hi Michal,

Is there any other JS version suitable for usage with PHP server (like
Ratchet)?

Have a look at Thruway:

https://github.com/voryx/Thruway

This is a WAMP v2 implementation that works with the latest AutobahnJS. It is actively maintained and developed.

It is both a WAMP client implementation (allows you to write app components), and also includes a router.

It also works like a charm with Crossbar.io:

http://crossbar.io/docs/Getting-started-with-PHP/

I would like to provide the session as service in window object. Now I
have to specify all subscriptions (which I want to do immediately) in
the onconnect callback. After implementation of my suggestion I could use
>>conn.subscribe('kittensCategory', ...
>>anywhere and it would send the subscription in first possible moment.||
>>Or is there a workaroud with which I could use conn.subscribe anywhere
on different places? (For example use conn.onload(function(){}) multiple
times and even after success connection?)

This is not how it works today, and to be honest, I don't see the point of being able to subscribe when there is no connection at all. I think it's a road to spaghetti / headaches ..

But hey, it's open-source: hack it! Probably I just don't get it yet ..

Cheers,
/Tobias

···

Am 29.10.2014 20:30, schrieb Michal Lohniský:

Dne středa, 29. října 2014 18:43:32 UTC+1 Tobias Oberstein napsal(a):

    Hi,

     > And then change the function ab.Session in this way (pseudo code):
     > before calling
     > self._websocket_onopen();
     > do
     > foreach (self.before_connect_subscribe_data as data) {
     > do_subscribe(data);
     > }
     >
     > Is my suggestion clear?

    Yes, but:

    1) AutobahnJS/WAMP1 (the version that is mentioned above) is no longer
    maintained. No changes will be applied to that code base anymore.
    2) What's the point adding complexity when you just can subscribe when
    connected?

    Cheers,
    /Tobias

     >
     > Thanks,
     > Michal
     >
     > --
     > You received this message because you are subscribed to the Google
     > Groups "Autobahn" group.
     > To unsubscribe from this group and stop receiving emails from it,
    send
     > an email to autobah...@googlegroups.com <javascript:>
     > <mailto:autobahnws+...@googlegroups.com <javascript:>>.
     > To post to this group, send email to auto...@googlegroups.com
    <javascript:>
     > <mailto:auto...@googlegroups.com <javascript:>>.
     > To view this discussion on the web visit
     >
    https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com
    <https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com>

     >
    <https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com?utm_medium=email&utm_source=footer
    <https://groups.google.com/d/msgid/autobahnws/11bb13ad-04cb-4c41-bbd7-c7d08a10d0f6%40googlegroups.com?utm_medium=email&utm_source=footer>>.

     > For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
To post to this group, send email to autob...@googlegroups.com
<mailto:autob...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/autobahnws/531c4004-775f-49cc-b861-18e986515923%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/531c4004-775f-49cc-b861-18e986515923%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes