Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion to communicate between 2 pages using nowjs
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Eric Zhang  
View profile  
 More options Sep 7 2011, 1:43 pm
From: Eric Zhang <e...@nowjs.com>
Date: Wed, 7 Sep 2011 10:43:45 -0700
Local: Wed, Sep 7 2011 1:43 pm
Subject: Re: [NowJS] Re: to communicate between 2 pages using nowjs

Maxi,

You don't need seperate servers to serve multiple html files. Instead you
need to parse the response and then serve files conditionally.

Consider using `express` http://expressjs.com/ as it abstracts away all of
the difficulty of serving files and is compatible with NowJS

Eric

On Wed, Sep 7, 2011 at 10:37 AM, maxi <mcoll...@gmail.com> wrote:
> Hi Eric,

> i tried with this :

> var fs = require('fs');
> var server = require('http').createServer(function(req, response){
>  fs.readFile(__dirname+'/game.tpl', function(err, data){
>    response.writeHead(200, {'Content-Type':'text/html'});
>    response.write(data);
>    response.end();
>  });
> });

> var server1= require('http').createServer(function(req, response){
>  fs.readFile(__dirname+'/report.tpl', function(err, data){
>    response.writeHead(200, {'Content-Type':'text/html'});
>    response.write(data);
>    response.end();
>  });
> });

> server.listen(8090);
> server1.listen(8090);

>  but I received an error :

> EADDRINUSE, Address already in use
> Error: EADDRINUSE, Address already in use
>    at Array.<anonymous> (net.js:1116:7)
>    at EventEmitter._tickCallback (node.js:126:26)

> Maxi

> On 7 Set, 09:36, Eric Zhang <e...@nowjs.com> wrote:
> > Hi Maxi,

> > You simply have to serve the other HTML page any way you choose. As long
> as
> > the server is the same, clients will connect to NowJS using the same
> `now`
> > object.

> > Eric

> > On Sun, Sep 4, 2011 at 2:21 PM, maxi <mcoll...@gmail.com> wrote:
> > > How to make communicate two pages on the same server?

> > > Example:

> > > var html = require('fs').readFileSync(__dirname+'/helloworld.html');
> > > var server = require('http').createServer(function(req, res){
> > >  res.end(html);
> > > });

> > > server.listen(8080);

> > > I'd like to open another connection with new page 'helloworld1.html'
> > > and syncing 'now Object' in both.

> > > is it possible ?

> > > thanks again

> > > Maxi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.