question

Upvotes
Accepted
8 4 6 17

NIP with 2 sessions

I'm using a NIP to publish on 4 ADH.
In the example named "mdiniprovomm", there are these lines (file LoginClient.java):

        // Note: This code assumes that there is only one login refresh
        // (the Session is configured with one Connection in the connectionList
        // so it only connects to one SrcDist).  If there is more than one
        // Connection, then this could would need to be changed to always
        // call processLogin(true) when there is a refresh.  In general,
        // if applications wish to use two Connections, it is recommended
        // that they use two Sessions.  That way the initial and recovery
        // refreshes will not be sent to Connections that do not need them.
        if ((respMsg.getMsgType() == OMMMsg.MsgType.REFRESH_RESP) &&
                (respMsg.getState().getStreamState() == OMMState.Stream.OPEN) &&
                (respMsg.getState().getDataState() == OMMState.Data.OK) )
        {
                if (!_loggedIn)
                {
                        _loggedIn = true;
                        _mainApp.processLogin(true);
                }
        }
        else if (respMsg.has(OMMMsg.HAS_STATE) &&
                        respMsg.getState().getDataState() == OMMState.Data.SUSPECT)
        {
                if (_loggedIn)
                {
                        _loggedIn = false;
                        _mainApp.processLogin(false);
                }
        }

As I said, I want to publish on 4 ADH. So I have 4 connections.

I don't want to do a dirty workaround and use 1 session for my 4 connections.... So, I was wondering if there's a code sample which already handles multiple sessions?

treprfarfa-apisessionnon-interactive-provider
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
23k 22 9 14

Hello @nicolas.roux,

Would RFA->OMM->mulitpleConsumers example (illustrates N sessions+logins) be of help to you, or you looking specifically for a multiProvider example ?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea