[ejabberd] exmpp and BOSH

Ian Wilkinson the.ian.wilkinson at googlemail.com
Thu Dec 10 16:44:03 MSK 2009


Hi Pablo,

My change did tend towards the pragmatic :)

On the get_conn_var/2 and set_conn_var/3, I'm guessing we should also
have {error, Reason::term()} as possible reply.

I'm happy to volunteer on the patch implementation, unless there
is a rush of people ahead of me.

And big thanks on the additional comment.

ian

On Thu, Dec 10, 2009 at 1:22 PM, Pablo Polvorin <
pablo.polvorin at process-one.net> wrote:

> Hello,
> ok, I see your point :).
>
> > -spec(get_bosh_rid(Session::pid()) -> {ok, integer()}).
> > get_bosh_rid(Session) ->
> >     gen_fsm:sync_send_all_state_event(Session, get_bosh_rid).
>
> I'd rather prefer to not include this on exmpp_session, as it only has
> a meaning if
> the underling connection is BOSH.
>
> I'd prefer a general way to get/set vars on the connection, something like
>
> -spec(get_conn_var(Session::pid(), Var::atom()) -> {ok, Value::any()}).
> get_conn_var(Session) -> [..]
>
> -spec(set_conn_var(Session::pid(), Var::any(), Value::any()) -> ok).
> get_conn_var(Session) -> [..]
>
> I'd happily apply a patch like that, any volunteers? :)
>
> Regarding session attachment,  keep in mind that you should be sure
> that no extra request is made
> from the webapp after you have asked for the RID (in BOSH, request
> aren't only triggered by data to send, a POST request could be
> triggered by a timeout, or by having receiving data from the server).
>
>
> 2009/12/9 Ian Wilkinson <the.ian.wilkinson at googlemail.com>:
> > Hi Pablo,
> > This may be huge dumbness on my part...from my reading of
> > http://metajack.im/2008/10/03/getting-attached-to-strophe/
> > it suggests you can establish the BOSH connection, and then make the sid
> and
> > rid
> > available as session state to allow their use in calling
> > connection.attach(BOSH_JID, BOSH_SID, BOSH_RID, onConnect);
> > from within the JavaScript client. The desire, here, to not expose the
> > user credentials.
> > Assuming this was a sound approach, I made the following changes:
> > exmpp_session.erl
> > %% @doc Obtain the Request ID for this BOSH connection.
> > -spec(get_bosh_rid(Session::pid()) -> {ok, integer()}).
> > get_bosh_rid(Session) ->
> >     gen_fsm:sync_send_all_state_event(Session, get_bosh_rid).
> > ...
> > handle_sync_event(get_bosh_rid, _From, StateName, #state{connection_ref =
> > ConnRef} = State) ->
> >     Reply = exmpp_bosh:get_rid(ConnRef),
> >     {reply, Reply, StateName, State}.
> >
> > And exmpp_bosh.erl
> > -spec(get_rid(Pid::pid()) -> {ok, integer()}).
> > get_rid(Pid) ->
> >     gen_server:call(Pid, get_rid).
> > ...
> > handle_call(get_rid, _From, #state{rid = Rid} = State) ->
> >     {reply, {ok, Rid}, State};
> >
> > I'm prepared for withering comment...
> > many thanks,
> > ian
> >
> > On Wed, Dec 9, 2009 at 7:07 PM, Pablo Polvorin
> > <pablo.polvorin at process-one.net> wrote:
> >>
> >> Hi Ian,
> >> I'm not sure to understand what is your intended scenario. Why do you
> >> need exmpp_bosh if your final
> >> goal is to use strophe?.
> >>
> >> Anyway, you are right,  currently there is no way to obtain the
> >> initial request ID after calling
> >> exmpp_session:connect_BOSH/4.
> >> Why do you need it?, it is only the initial request ID, or the last
> >> request ID sent?.  It could be added to the exmpp API if there is a
> >> need for this.
> >>
> >>
> >>
> >> 2009/12/7 Ian Wilkinson <the.ian.wilkinson at googlemail.com>:
> >> > Hi,
> >> > I'm looking to adopt Strophe as client-side library, and following the
> >> > reading
> >> > of http://metajack.im/2008/10/03/getting-attached-to-strophe/, I'm
> >> > attempting
> >> > to discover how to obtain the Request ID from the session created with
> >> > exmpp_session:connect_BOSH/4.
> >> > There is strong comment that exmpp_bosh should not be called by client
> >> > developers (I had noticed exmpp_bosh:reset_parser/1 gave visibility of
> >> > the
> >> > rid).
> >> > So, for the moment I am struggling to discover the correct method for
> >> > obtaining the Request ID I can then use with Strophe.
> >> > Any help very welcome (and it may be I am betraying ignorance on XMPP
> >> > usage).
> >> > many thanks,
> >> > ian
> >> >
> >> >
> >> > _______________________________________________
> >> > ejabberd mailing list
> >> > ejabberd at jabber.ru
> >> > http://lists.jabber.ru/mailman/listinfo/ejabberd
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Pablo Polvorin
> >> ProcessOne
> >> _______________________________________________
> >> ejabberd mailing list
> >> ejabberd at jabber.ru
> >> http://lists.jabber.ru/mailman/listinfo/ejabberd
> >
> >
> > _______________________________________________
> > ejabberd mailing list
> > ejabberd at jabber.ru
> > http://lists.jabber.ru/mailman/listinfo/ejabberd
> >
> >
>
>
>
> --
> Pablo Polvorin
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20091210/935ae804/attachment.html>


More information about the ejabberd mailing list