Home Help Center

Trouble running javascript demos in browser....

smandysmandy Member Andy SmithOrganization: Self EmployedProject: Learning Ice
Hi All,

I'm trying to use the ice javascript demos as a means of finally learning javascript :-)

I've run the node based client/server examples and can get the node hello client chatting to a python or C++ hello server, that's all fine. What I'm interested in playing with though is browser client to Python/C++/Java servers.

So I guess two points. Looking at the code am I right in saying if I don't want to use websockets I'm not obliged to? it looks like the node hello client is doing pretty 'vanilla' ice code, so I'm a little confused about why websockets and glacier are being mentioned in the documentation. Could someone clarify?

Second I'm just trying to get a hello client running in the browser. I have a python hello server running, And (here's maybe what I'm doign wrong), I'm just naively opening up the index.html in the demos folder. It's failing when I try to run the demo ... here's screenshot of my javascript console. Having trouble finding ice by the looks of it.

It's probably something very stupid but I'm a js newbie. Any help appreciated!

Cheers,

A.



Attachment not found.

Comments

  • smandysmandy Member Andy SmithOrganization: Self EmployedProject: Learning Ice
    Ahh.... getting there. Didn't read the docs properly! Doh. I hadn't done the gulp:build step :-)

    Cheers,

    A.



    smandy wrote: »
    Hi All,

    I'm trying to use the ice javascript demos as a means of finally learning javascript :-)

    I've run the node based client/server examples and can get the node hello client chatting to a python or C++ hello server, that's all fine. What I'm interested in playing with though is browser client to Python/C++/Java servers.

    So I guess two points. Looking at the code am I right in saying if I don't want to use websockets I'm not obliged to? it looks like the node hello client is doing pretty 'vanilla' ice code, so I'm a little confused about why websockets and glacier are being mentioned in the documentation. Could someone clarify?

    Second I'm just trying to get a hello client running in the browser. I have a python hello server running, And (here's maybe what I'm doign wrong), I'm just naively opening up the index.html in the demos folder. It's failing when I try to run the demo ... here's screenshot of my javascript console. Having trouble finding ice by the looks of it.

    It's probably something very stupid but I'm a js newbie. Any help appreciated!

    Cheers,

    A.



    Attachment not found.
  • smandysmandy Member Andy SmithOrganization: Self EmployedProject: Learning Ice
    So have all demos running now. Very cool!

    So just have one question remaining. Will the javascript mapping only support websockets going forward. i.e. for any service that needs to support javascript client will it be a requirement to open up a websocket adapter?

    Don't see that as a problem if websockets is now supported by all the language mappings, just want to understand what the situation is...

    Also attempting to answer my previous question - was Glacier being mentioned solely because in the early days websockets were only implemented on the C++ side? but now all language mappings are supported, glacier isn't required for simple communication that doesn't require a router?

    Cheers,

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

    JavaScript in the browser only support WebSocket communication, because that is what is provided by modern browser, you cannot use raw TCP sockets with JavaScript.
  • smandysmandy Member Andy SmithOrganization: Self EmployedProject: Learning Ice
    Ah I didn't realise that. Okay that makes perfect sense. Thanks for quick response!

    Cheers,

    A.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,
    smandy wrote: »
    So have all demos running now. Very cool!
    Also attempting to answer my previous question - was Glacier being mentioned solely because in the early days websockets were only implemented on the C++ side? but now all language mappings are supported, glacier isn't required for simple communication that doesn't require a router?

    That's right Glacier2 isn't required anymore to talk to a Java or C# server since we now support the WebSocket transport for these language mappings.

    However if you have multiple services running, with or without different language mappings, the use of Glacier2 might still be a good idea if you need to secure or limit the access to these backend services. Through its session mechanism, Glacier2 also allows managing "backend" resources allocated for the client and the session can provide a simple view to the services available on the backend (the facade design pattern).

    Cheers,
    Benoit.
  • smandysmandy Member Andy SmithOrganization: Self EmployedProject: Learning Ice
    benoit wrote: »
    Hi,



    That's right Glacier2 isn't required anymore to talk to a Java or C# server since we now support the WebSocket transport for these language mappings.

    However if you have multiple services running, with or without different language mappings, the use of Glacier2 might still be a good idea if you need to secure or limit the access to these backend services. Through its session mechanism, Glacier2 also allows managing "backend" resources allocated for the client and the session can provide a simple view to the services available on the backend (the facade design pattern).

    Cheers,
    Benoit.

    Got it ... thanks!

    A.
Sign In or Register to comment.