Discussions

EJB design: server push

  1. server push (10 messages)

    hi,
    i am developing a appilication
    which should update the client in
    a regular basis.when ever the server
    wants it should push the data to the
    client.i don't want to use
    client polling.How server push takes
    place .plz help me.
    regards
    praveen

    Threaded Messages (10)

  2. server push[ Go to top ]

    Use JMS to send a message to your client?

    Cheers,
    Rick
  3. server push[ Go to top ]

    hai rick,
    thanks for responding.
    i don'nt know how to
    use JMS.my need is something
    like this, the server needs
    to push web pages to the
    client.its like webcollaboration.
    the server takes the control of
    the client browser and pushes
    the web pages.The pages are pushed
    in some order.The browser should
    get refreshed for every push.
    can u help me regarding this.

    one more thing i got to ask u.
    iam developing a chat server with
    max clients of 2000 people.
    if i implement the chat server
    as a servlet and the chat client
    as applet will it be robust?
    think in terms of load on the
    server.

    Thanks
    regards

  4. server push[ Go to top ]


    Unless you are writing you're own browser then you will have to make use of an applet (aaaargghh!!) to do this. If you create a simple applet that can listen for push messages on a DatagramSocket or whatever and embed this in a non content frame. From here the applet can refresh the content pane without having to be reloaded itself.

    Then you need a DatagramServer to sit on your server side and fire the push messages to the client applet.

    The biggest problem is keeping track of which clients are active and belong to a given user - i worked round this by having the applet register itself (ie send a registration packet to the server) when start() is called and send an unregister packet on stop().

    Hope thats of some help

    Stu
  5. server push[ Go to top ]

    hi,
    If i use a servlet to push messages
    to applet and the applet receives the
    pushed message will it work if the
    applet is behind the firewall?
    If the load is more say some 1000 clients
    are there will it be efficient?
    regards
    praveen
  6. server push[ Go to top ]

    If your server is behind a firewall you will have to ensure that the firewall is set up to allow incoming and outgoing datagram packets.

    As for will it scale i can't say for sure as i've only tried this for a demo system. I don't see why it shouldn't your server only has to maintain a single datagram socket and you can just queue all the refresh messages. The one benefit is that you should have less load on the server than if the client just polls or the page is set to refresh at regular time intervals.


    Stu
  7. server push[ Go to top ]

    Thanks stu,

    i've just tried that its working
    fine with the client behind the firewall
    and proxy.

    I just want to do some more things here.
    If the servlet sends a link ,i want that
    link to be opened in a new browser window.
    When ever the servlet pushes some url
    that URL is refreshed in that window.
    In this case also i do not want to use
    client polling b'coz of the performance
    constraints.
    whenever the server pushes the url it
    should reflect in the window.
    Got any idea how to it.

    regards
    praveen.S
  8. server push[ Go to top ]

    Hi Praveen

    Glad to hear it is working !!

    What you should be able to do is set the content of the datagram packet to be the url that you wish the browser to display. All you then do is when the applet recieves a packet it gets the content and redirects the content frame to there.

    Check the applet documentation there is a method called showDocument() which takes a url and a target frame and will cause the content identified by the URL to be loaded into the named frame.

    Stu
  9. server push[ Go to top ]

    hai stu,
    thanks a lot .Its working fine here.

    regards
    praveen
  10. server push[ Go to top ]

    hai ,
    i got a big doubt.
    iam implementing a chat server which
    should handle atleast 1000 clients.
    i am planning to use socket for that.

    Is there any restriction in the number of client
    for the socket client?

    Will it be scalable if i use sockets?

    How abt using RMI for the same?

    please reply.
    thanks and regards
    praveen.S
  11. server push[ Go to top ]

    hai,
    i need to open a url from the applet.
    now i use AppletContext.showDocument()
    for that.but this method is supported
    only in IE,Netsacape and HotJava.
    other browser won't support that.Is
    there any other way to open a url from
    the applet.
    thanks and regards
    praveen.S