solace broker WSS connection issue

dhimanmayank
dhimanmayank Member Posts: 11
edited September 2021 in PubSub+ Event Broker #1

WSS connection is not getting established for solace. Neither with/out corporate vpn.

Tagged:

Comments

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    hi @dhimanmayank

    Can you tell us more. What's the error you see would be great for a start :)

  • dhimanmayank
    dhimanmayank Member Posts: 11

    hi @arih
    I am trying to get connected to solace service via web socket broker url. But, after running the client, it is saying "connection cannot be established".

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    I see, okay, so where is this client? Is this a web app that you create, or something provided like the Try-Me app in Solace web interface?

    Might help if you show a screenshot too.

    For now, I would think this is a connection issue, could be the URL is incorrect or the port is incorrect. Sometime the default/provided port might not be the one that is actually running.

  • dhimanmayank
    dhimanmayank Member Posts: 11

    @arih Thanks for the prompt response!
    I am using a web app as client. Below is the url which I am using:
    wss://mrnb5646to7em.messaging.solace.cloud:443

    And the complete properties is as below:
    connectOptions = {
    sBROKERURL: 'wss://mrnb5646to7em.messaging.solace.cloud:443',
    sVPN: 'dman-solace-fundas',
    sUSERNAME: 'solace-cloud-client',
    sPASSWORD: '************',
    sPublishTopic: 'solace/test/project/chat',
    sSubscribeTopic: 'solace/test/project/chat',
    sReceiveQueue: ''
    }

  • amackenzie
    amackenzie Member, Employee Posts: 262 Solace Employee

    just to be clear, you are just connecting to the socket via JS or something like that without using one of the Solace APIs? This isn't going to work.

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Could you check if the secured web transport is in fact enabled in the MessageVPN? It should looks like this:

  • dhimanmayank
    dhimanmayank Member Posts: 11

    @arih it is enabled for web transport.
    @amackenzie I am using Solace API :smile:
    connect(oResultCallback) {

    //build the full URI to the broker. Makes for a more informational alert/debug message.
    var sFullURI = this.sUSERNAME + ":" + this.sPASSWORD + "@" + this.sBROKERURL + "/" + this.sVPN;
    console.debug("Establishing session to " + sFullURI);
    
    try {
      this.broker.session = solace.SolclientFactory.createSession({
        // solace.SessionProperties
        url: this.sBROKERURL,
        vpnName: this.sVPN,
        userName: this.sUSERNAME,
        password: this.sPASSWORD
      });
    } catch (error) {
      console.error(error.message);
    }
    
  • amackenzie
    amackenzie Member, Employee Posts: 262 Solace Employee

    for sure some further info on the actual error message would be useful.

  • dhimanmayank
    dhimanmayank Member Posts: 11


    @amackenzie
    Let me know if you need any further details.

  • dhimanmayank
    dhimanmayank Member Posts: 11

    Sorry for the long image!! :/

  • dhimanmayank
    dhimanmayank Member Posts: 11

    @arih 👆 Please check

  • amackenzie
    amackenzie Member, Employee Posts: 262 Solace Employee

    is there anything extra if you expand the ">" on the JS console?

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    it could still be a connection issue I think. Are you using a proxy for http?

    could you do this below and see what happens from terminal?

    curl -vvv https://mrnb5646to7em.messaging.solace.cloud:443

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    other way to test is just clone this git repo here and open up the TopicPublisher sample https://github.com/SolaceSamples/solace-samples-javascript/

  • dhimanmayank
    dhimanmayank Member Posts: 11

    @arih Proxy is disabled, via curl it is getting connected

  • dhimanmayank
    dhimanmayank Member Posts: 11

    @amackenzie Please find the expanded console

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    @dhimanmayank said:
    @arih Proxy is disabled, via curl it is getting connected

    Okay, I assume you'll get something like "Empty reply from server" - which is good. Well that means you computer can connect, but your app cannot.

    Can you try connecting to your broker using the sample javascript here instead of your own app? https://github.com/SolaceSamples/solace-samples-javascript just clone the whole thing, and create a lib folder inside with the solace JS API lib.

    If the sample app can connect, then we might need to look more into your HTML and JS code too.