Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Would this be possible?

    I have just been browsing for perl related stiff and stumbled onto chat rooms. i've though about doing this in perl before but i've always have do use quite low bandwidth allowance servers so have steered clear to preserve it. however i saw a version of a perl chat room that used a server push and this got me thinking.

    i've never used a server push before but i have a rough idea of how it works. as far as i know you can send text data (or any for that matter but in this case i'm thinking text) down that will over write the data currenty on the page with the new stuff but cos the connection is open the server can send it whenever it wants to. my thinking is this could be quite alot of information to transfere if you are sending complex data. this is turning out to be quite a long winded explaination so i will shorten it down abit.

    i know that a server push is not a JS issue but bare with me. my thinking is that it would be possible to create dynamic pages that can be changed when a server side script decides it should be. my concept for doing this is to have an invisible iframe or similar that is connected to the server push and javascript in the main window/frame that monitors the pushed data and acts upon it accordingly.

    is this even possible? what kind of data format would you have to use? have a stumbled onto something that has been used for ages and everyone except me knows about?

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is sorta been done already (altho it is argubably more client-pull than anything else). it's called Javascript Remote Scripting or JSRS for short.

    you can check it out here .
    *keep it simple (TM)

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i have no doubts that this is possible by a client pull method and i'm sure its been done many times before but the client pull has the limitations of having to check too see if theres a change in server side state every few seconds which would be wastfull on resources if you are waiting for something that is going to happen on occasion.

    i use the chat room for example as this is what made me think of this.

    you have a chat room that has only a few users. there maybe only one person on it at a time while they wait for someone else to come in. in a client pull situation you are checking for info every few seconds to see if anyone else is using it which seems like an awful waste of time and energy if you are there even 10 mins.

    however using a server push your browser would stay connected and wait for more data to be sent down to it. so in the same 10 mins you have only had 1 data transfere rather than maybe 200 opened and closed connections.

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    there are Java implementations of server-push known as Pushlets. you could investigate them and then translate them into PERL, tho that sounds like a nightmare if ya ask me LOL
    *keep it simple (TM)

  • #5
    Regular Coder
    Join Date
    Sep 2004
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah thats why i'm interested in doing it this way. i was actually kind of thinging of it as a simple mans java....

    i think this would be something more accessable to most peoples skills and resources (definaltly mine)

    but i'm still no closer to knowing if anyone has/can impliment it? and if so how?

  • #6
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by andyede
    i was actually kind of thinging of it as a simple mans java.
    no, when i said Java, i meant Java, not Javascript, which is not the same thing. you will still need JS to parse the data the page receives into HTML, but, in terms of Pushlets, it's Java which generates or processes the data to send to the client.
    *keep it simple (TM)

  • #7
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here's a link to JSP-driven HTTP-Push page: Pushlet Mechanism Basics

    hope that helps
    *keep it simple (TM)

  • #8
    Regular Coder
    Join Date
    Sep 2004
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i know this is possible in java. most 'heavy duty' chat rooms i've seen have been. but when i said a simple mans java, i ment a simple mans java. I don't know how to program java but i'm an intermediate perl programmer and i can just about hold my own with JS (although lacking experiance) and so i'm looking for a way of doing this with the skills that i (and maybe lots of other people) have.

    using JS to parse the data was the fundimental concept that i had. however will this be possible to monitor a frame that is undergoing server push and what sort of data format would you use?

  • #9
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by andyede
    I don't know how to program java but i'm an intermediate perl programmer and i can just about hold my own with JS (although lacking experiance) and so i'm looking for a way of doing this with the skills that i (and maybe lots of other people) have.
    fair play. Java's not for the faint of heart. i consider myself a fairly good coder, but have struggled to learn Java, so tend to just stick to using JSTL when using JSP. my Perl was somewhat intermediate, but I haven't done any in anger for nearly two years now and it has somewhat ebbed away in that time.

    anyway, you should still be able to push data to the client using PERL.

    Quote Originally Posted by andyede
    using JS to parse the data was the fundimental concept that i had. however will this be possible to monitor a frame that is undergoing server push and what sort of data format would you use?
    yes, use XML to send to the iframe and then read that using JS. it may be that you could send a Javascript file itself and have it alter the parent page when it loaded.

    to be honest, this is fairly sophisticated JS and if you do this your skills will have improved quite substantially. good luck
    *keep it simple (TM)

  • #10
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i found this, if it's of any help: Server Push in PERL
    *keep it simple (TM)

  • #11
    Regular Coder
    Join Date
    Sep 2004
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    read that one already

    guess i'm going to have to try some of it out for myself and see what i can get to work.

    i thought i would post it here and see what other people thought. would still be interested to know some other peoples opin9ions on the topic?

    i thought this could have many applications from chat rooms to live dynamic multiplayer games.

  • #12
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by andyede
    would be interested to know some other peoples opin9ions on the topic?
    yeah, me too.

    Quote Originally Posted by andyede
    i thought this could have many applications from chat rooms to live dynamic multiplayer games.
    it would. but to be honest, it sounds as tho XML over HTTP (XMLHttpRequest and XMLHttp) have taken over. but that's client-pull, and, of course, not wot you want.
    *keep it simple (TM)

  • #13
    Regular Coder
    Join Date
    Sep 2004
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i'm thinking that you could send a very simple page to an invisible frame something like:

    Code:
    <script>
    a = 'something'
    b = 'somthing else'
    </script>
    and define/change global vars that the main program can use to add/change the current page. but i'm also thinking that it might not be possible for the browser to execute a script while its still being pushed. to be honest i don't have a clue. i'm on the envelope of my knowlege at the moment.
    Last edited by andyede; 11-05-2004 at 01:14 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •