Home Help Center

javascript client using secure web sockets

alversonalverson Member Dennis AlversonOrganization: Braxton TechnologiesProject: Orbital Analysis
Can a javascript client use a secure web socket end point on a C++ server? I can't seem to find an example for that.

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Dennis,

    You can use WSS endpoint to connect to Ice servers, our JavaScript demos do that. Look for example at Hello demo, the server has WSS endpoints enabled in config.server and configure IceSSL as usually, note it should set IceSSL.VerifyPeer=0 as client side certificates are not supported with WSS. The JavaScript Client.js then configure a wss endpoint.

    Note certificate must be properly signed to be accepted by the browser, if you are using a self signed certificate you might need to configure your browser to accept it.

  • alversonalverson Member Dennis AlversonOrganization: Braxton TechnologiesProject: Orbital Analysis
    Great....thanks for pointing me in the right direction.
  • alversonalverson Member Dennis AlversonOrganization: Braxton TechnologiesProject: Orbital Analysis
    I can't seem to get the demo working. I get the ws connection working but not the wss connection. I verified that the HttpServer is running on the 9090 port and /demowss is running on port 10003 but I'm getting the following error when I attempt to call sayHello:

    Firefox can't establish a connection to the server at wss://127.0.0.1:9090/demowss

    Any ideas?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    How did you deploy the Client, did you run gulp watch in the js directory? wss://127.0.0.1:9090/demowss is the address of the WSS proxy used by the demo, this is launched when you run gulp watch command and is part of the JavaScript HTTP server included with the demos.

    The reason to use a proxy here is because some browser like firefox certificate exceptions require to match the host and port.

    In the demo when you select "Twoway Secure" mode it redirects the browser to an HTTPS url, and that is because WSS connections are not allowed from HTTP pages, The first time you will se a warning about the connection not being secure you can add an exception from the advanced options. After that you will be able to communicate with the Hello server using SSL.

    And alternative is to add the demo CA certififate to the Authorities and mark it as "Trust this CA to identify websites".

    And don't forget to set IceSSL.VerifyPeer=0 on the server side.
  • alversonalverson Member Dennis AlversonOrganization: Braxton TechnologiesProject: Orbital Analysis
    I am finally able to get back to this problem.

    I am attempting to first execute the hello world demo C:\Ice-3.6.0-demos\js\Ice\hello\Client.js as a node.js application using a C++ server but the SSL option seems to be commented out (see below - I've also attached the file that is in my demo installation). I would like to test this incrementally, first getting the node.js client application working first, and then move on to the client browser application where I need to ultimately end up. [FONT=&quot]
    function menu() { process.stdout.write( "usage:\n" + "t: send greeting as twoway\n" + "o: send greeting as oneway\n" + "O: send greeting as batch oneway\n" + "f: flush all batch requests\n" + "T: set a timeout\n" + "P: set a server delay\n" + //"S: switch secure mode on/off\n" + "s: shutdown server\n" + "x: exit\n" + "?: help\n" + "\n"); } [/FONT]

    BTW - I already have an ICE web client working with ws but not wss which I have been using for quite a while just to let you know that I have successfully utilized a node.js http server based on the one that came with js demo applications.
  • alversonalverson Member Dennis AlversonOrganization: Braxton TechnologiesProject: Orbital Analysis
    I am finally able to get back to this problem.

    I am attempting to first execute the hello world demo C:\Ice-3.6.0-demos\js\Ice\hello\Client.js as a node.js application using a C++ server but the SSL option seems to be commented out (see below - I've also attached the file that is in my demo installation). I would like to test this incrementally, first getting the node.js client application working first, and then move on to the client browser application where I need to ultimately end up. [FONT=&quot]
    function menu() { process.stdout.write( "usage:\n" + "t: send greeting as twoway\n" + "o: send greeting as oneway\n" + "O: send greeting as batch oneway\n" + "f: flush all batch requests\n" + "T: set a timeout\n" + "P: set a server delay\n" + //"S: switch secure mode on/off\n" + "s: shutdown server\n" + "x: exit\n" + "?: help\n" + "\n"); } [/FONT]

    BTW - I already have an ICE web client working with ws but not wss which I have been using for quite a while just to let you know that I have successfully utilized a node.js http server based on the one that came with js demo applications.
  • alversonalverson Member Dennis AlversonOrganization: Braxton TechnologiesProject: Orbital Analysis
    I believe I have figured it out. I'll let you know if I have any other questions.
Sign In or Register to comment.