BTW, you can even transport your view with the socket :)
<body>
<a data-page="contact" href="#">Contact</a>
<div id="#container">
</div>
<body>
<script type="text/javascript">
$(document).ready(function(){
$("a[data-page]").click(function(){
socket.emit("render", $(this).attr("data-page");
});
socket.on("render-done", function(data){
$("div#container").html(data);
});
});
</script>
There are a lot of missing things but here are my 2 cents :)
--
Att,
Alan Hoffmeister
2012/7/26 Alan Hoffmeister <[email protected]>:
> Iframes are bad, use AJAX calls:
> https://github.com/defunkt/jquery-pjax/
>
> --
> Att,
> Alan Hoffmeister
>
>
> 2012/7/26 Diogo Resende <[email protected]>:
>> If you really have to reload the page, you can have one page to login and
>> then an iframe (if successful login) that spans the entire browser viewport
>> and opens all the pages. This way the parent document will not reload and it
>> can connect to you.
>>
>> --
>> Diogo Resende
>>
>> On Thursday, July 26, 2012 at 10:31 , Ludo wrote:
>>
>> Hello,
>>
>> I am building a website with nodeJS. The goal is the user launch a session
>> when he logs his account (so i create a socket), but i am looking for the
>> best way to keep this socket (on the client side) all along the navigation.
>>
>> For exemple, if the user go from "monsite.com/login.php" to
>> monsite.com/home.php i am going to loose the socket which i created in
>> "monsite.com/login.php"...
>>
>> How would you do that ? Is it really appropriate to work with PHP ? Because
>> i think you don't have this kind of problem with a website build with a JS
>> Framework like Blackbone.js !
>>
>> Thanks for your advices !
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en